- January 1, 2021
- Comments Disabled
Introduction & Project Reasoning
The reasoning behind this project was to expand on my theoretical knowledge of Azure, by provisioning a VM that was suitable to install a LAMP (Linux, Apache, MYSQL, and PHP) stack. I have previous experience doing this on a local machine which was used as a staging environment, so much of what I knew could be carried over to Azure. The framework of choice was WordPress, with the end goal being to create a copy or even migrate an existing site I have created to the VM. Prior to carrying out any installations, I did some research on Azure pricing and took note of what would be the most applicable and cost effective configuration for this project.
Project Outline
All deployments for this project were done using infrastructure as code (IaC), to help build on my knowledge of PowerShell and the syntax used within Azure. I began by creating a resource group using the following command, which allows a resource to be named and allocated to a region. It may be force of habit with AWS, but I tend to deploy my resources in US East as there tends to be greater access with lower billing rates:
powershell
az group create --name portfolio --location eastus
I then provisioned a VM, by allocationg it to a resource group, giving it a name, root username, as well as an image (in this case UbuntuLTS, to avoid any OS bugs) as well as generating ssh keys so I could remote into the machine.
powershell
az vm create --resource-group portfolio --name wp-vm --image UbuntuLTS --admin-username alcloud --generate-ssh-keys
Below is how the machine looked in JSON format.
{
"fqdns": "",
"id": "/subscriptions/566e408d-8560-4b1f-a63c-8333a30de8c2/resourceGroups/portfolio/providers/Microsoft.Compute/virtualMachines/wp-vm",
"location": "eastus",
"macAddress": "00-22-48-27-98-55",
"powerState": "VM running",
"privateIpAddress": "10.0.0.4",
"publicIpAddress": "20.228.163.28",
"resourceGroup": "portfolio",
"zones": ""
}
In order to make this machine a web server, I needed to open up port 80 to allow incoming traffic. This was done using the following command:
az vm open-port --port 80 --resource-group portfolio --name wp-vm