This is part two of a five-part series on the “Development of a Django web app from testing to production and hosting onto Microsoft Azure’s virtual machine”.
For this series we will focus on:
- Part 1: Developing the Django Web App: Here, we improved the “Restful A.P.I.s in Django Project” we built by building its UI/Web platform as it was only accessible via postman so that users can access the system via web interface with more features. Click here to go through the article
- Part 2: Acquire a VM from Microsoft Azure: Here we will take a user through the process of choosing the best VM with regards to cost and performance
- Part 3: Setting up the VM and uploading of the Project using GIT.
- Part 4: Configuring the Django project on the VM and making it accessible online
- Part 5: Monitoring of the Django Web App using Microsoft Azure Tools
Intended audience: Who the article is for
This article targets anyone who wants to know where to start using Microsoft Azure’s virtual machines to host their data.
Case Study: What the article is going to cover
This piece aims to give you a basic understanding of how to select a virtual machine from Microsoft Azure and how to gauge the best one based on your needs.
- A web browser
- A credit or debit card
- An email account
Getting started with Microsoft Azure
Creating a Microsoft Account
To create a Microsoft account, open your browser and type “Microsoft account sign up”, it should take you to the page below for you to enter your details or click here to go to the Microsoft account page
Click on the link labelled “Create a Microsoft Account.”
Follow the remaining steps provided for you to sign up
After a successful sign up you will be directed to your profile/admin page, similar to the one below:
Once your Microsoft account is created, you get access to Google services like Office 365 etc.
Accessing Microsoft Azure To create a Microsoft Azure account, open your browser and type “Microsoft Azure account sign up”, it should take you to the page below for you to enter your details or click here to go to the Microsoft Azure Account
Click on the link labelled “Try Azure for Free”
It will take you to the page below:
Click on the link labelled “Start Free”, where you will be taken to the sign-up page below:
Sign In using the Microsoft Account we just created. Azure will verify the account’s existence before redirecting you to the page below to enter your password. You can tick the option to stay signed in
You will be redirected to the profile page below for you to fill in your profile information.
On the Profile page, your number will be requested for verification, to send an OTP code for verification.
After successful verification, you will be, prompted to enter your credit or debit card details; this is done so as to ensure that it’s not a bot signing up and the card will not be charged until you decide to upgrade to the pay as you go model.
After entering the information above, click on “Sign Up”
You will then be redirected to the page below:
Click on the button labelled “Go to Azure Portal”
You will be redirected to the page below
You are now logged into the Microsoft Azure Portal.
This free Microsoft Azure account gives you $200 credit or 1 month of free use.
Virtual Machine Selection
Here we will look into how to decide which virtual machine to use.
Microsoft Azure makes this easy for its users by providing a pricing calculator.
Here is the link to Microsoft Azure’s pricing calculator
Below is the pricing calculator page
Select “Virtual Machines”, a notification labelled “Virtual Machine Added. View” will be displayed.
Click on “View” or scroll down the page to view the virtual machine selected.
Below is a screenshot of the virtual machine features and pricing
The virtual machine we want should have the following features:
- 1 virtual machine
- Linux Operating System
- The type of Operating System will be Ubuntu.
- It will be a basic virtual machine as the system hosted on it is not intended to be heavy.
- 4GB RAM, with 2 Virtual CPUs and 8GB Temporary Storage
- Located in West Europe, you’re free to use whichever you want, but its preferred to use one close to most of your clients/users.
- Under category, we will select “General Purpose.”
- Under “Instance Series” we will select “Bs-Series” as this option will provide us with a fair for the virtual machine specifications we want.
- Under “Instance” we will select “B2S: 2 Cores, 4 GB RAM, 8 GB Temporary Storage”
- Scroll down to the “Managed Disk” section, expand the dropdown menu and enter the option of having P1 Disk Size Premium SSD disk connected to our virtual machine:
This will give a final monthly cost of $35.82, down from $152.62 if we decide to finally upgrade our free account to a pay as you go model.
Acquiring a Virtual Machine from Azure
With the information above, we will now go back to the Azure portal and select the option “Deploy a Virtual Machine.”
You will be asked to select either Windows or Linux virtual machine, select Linux and click “create.”
You will be taken to the page below.
Under “Resource group” click on the link “Create new” and enter the name “django”
This is to place every resource linked to this VM into one group for easy management and deletion of resources or data linked to the group
Under “Instance details”
Virtual machine name: “djangowebapp”
Region: “West Europe”
- next to the drop drown, click on “See all sizes”
- you will be taken to the page below to select the VM size
- We will choose the option “B2S: 2 Cores, 4 GB RAM, 8 GB Temporary Storage”
- Click on “Select”
Below is how the instance details should look like
Under “Administrator account”
- Authentication Type: Password
- Enter Username and Password
Under “Inbound port rules”
- Public inbound ports: Allow selected ports
- Select inbound ports: Select HTTP, HTTPS, SSH
Scroll to the bottom of the page and click on the button labelled “Next: Disks >”
Under “Disk options.”
- OS Disk Type: Premium SSD (locally-redundant storage)
Finally, click on the last tab on the right labelled “Review + create”
Then click on the button labelled “create”
Give it some time to deploy
Once it’s done, you will see a page similar to the one below
Click on the “Go to resource” button, and you will be taken to the “djangowebapp” virtual machine you just created.
You have now successfully created a Linux virtual machine in Microsoft Azure
You should now have a basic understanding of creating a virtual machine in Microsoft Azure. In the next series article, part 3 of 5, we will look into connecting to the VM, setting up the VM and uploading the Django project we created in part 1 using GIT.
Please let me know how your experience was, Thank you.