diff --git a/content/nginx/deployment-guides/microsoft-azure/virtual-machines-for-nginx.md b/content/nginx/deployment-guides/microsoft-azure/virtual-machines-for-nginx.md index d89c7c69e..90aded6d8 100644 --- a/content/nginx/deployment-guides/microsoft-azure/virtual-machines-for-nginx.md +++ b/content/nginx/deployment-guides/microsoft-azure/virtual-machines-for-nginx.md @@ -10,60 +10,63 @@ type: - how-to --- -These instructions explain how to create virtual machines (VMs) in the Microsoft Azure environment that are suitable for running NGINX Open Source and NGINX Plus. +Follow this guide to install and run NGINX Open Source or NGINX Plus on a Microsoft Azure virtual machine. -The names and other settings used in this guide are appropriate for the high‑availability deployment described in [Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer]({{< ref "high-availability-standard-load-balancer.md" >}}), but the VMs can be used for any purpose. +This guide’s settings support [Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer]( https://docs.nginx.com/nginx/deployment-guides/microsoft-azure/high-availability-standard-load-balancer/). But you can repurpose your VMs for other tasks. -For NGINX Plus, a faster alternative is to purchase a prebuilt VM in the [Microsoft Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=NGINX%20Plus) (several current operating systems are available). For instructions, see [Installing NGINX Plus on Microsoft Azure]({{< ref "nginx/admin-guide/installing-nginx/installing-nginx-plus-microsoft-azure.md" >}}). +To speed up NGINX Plus deployment, get a prebuilt VM from [Microsoft Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=NGINX%20Plus). There are various operating systems available. See [Installing NGINX Plus on Microsoft Azure](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus-microsoft-azure/) for more details. ## Prerequisites -These instructions assume you have: +Azure Setup: -- An Azure [account](https://azure.microsoft.com/en-us/free/). -- An Azure [subscription](https://docs.microsoft.com/en-us/azure/azure-glossary-cloud-terminology?toc=/azure/virtual-network/toc.json#subscription). -- An Azure [resource group](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview#resource-groups). In this guide, it is called NGINX-Plus-HA. -- An Azure [virtual network](https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-overview). -- If using the instructions in [Automating Installation with Ansible](#automate-ansible), basic Linux system administration skills, including installation of Linux software from vendor‑supplied packages, and file creation and editing. +- Active Azure [account](https://azure.microsoft.com/en-us/free/). +- Azure [subscription](https://docs.microsoft.com/en-us/azure/azure-glossary-cloud-terminology?toc=/azure/virtual-network/toc.json#subscription). +- Azure [resource group](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview#resource-groups). In this guide, it is called NGINX-Plus-HA. +- Azure [virtual network](https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-overview). -In addition, to install NGINX software by following the linked instructions, you need: +For [Ansible Installation](#automate-ansible): +- Basic Linux system administration skills, including installation of Linux software from vendor‑supplied packages, and file creation and editing. -- A paid or trial NGINX Plus subscription, if you plan to install that product. -- `root` privilege on the hosts where NGINX Open Source and NGINX Plus are to be installed. If appropriate for your environment, prefix commands with the `sudo` command. +For NGINX installation: + +- NGINX Plus subscription (paid or trial). +- `root` access or `sudo` privilege on your preferred host for NGINX Open Source and NGINX Plus. If appropriate for your environment, prefix commands with the `sudo` command. ## Creating a Microsoft Azure Virtual Machine -1. Access the [Microsoft Azure portal](https://portal.azure.com/) (****) and sign in. - -2. Click the **Virtual machines** icon. (If that icon doesn't appear at the top of your window, click the stacked‑lines icon in the upper left corner of the title bar and click **Virtual machines** in the navigation column that opens at left.) +1. Sign in to the [Microsoft Azure portal](https://portal.azure.com/). +2. Click the Virtual machines icon. Or click the stacked lines icon (☰) in the top-left corner and select Virtual machines from the menu. screenshot of top navigation bar at Microsoft Azure portal -3. On the **Virtual machines** page that opens, click **+ Add** in the upper left corner. +3. On the Virtual machines page that opens, click **+ Add** in the upper left corner. screenshot of Azure 'Virtual machines' page -4. In the **Create a virtual machine** window that opens, enter the requested information on the **Basics** tab. In this guide, we're using the following values: +4. In the **Create a virtual machine** window that opens, enter the requested information on the **Basics** tab. For this guide, use the following values: - **Subscription** – NGINX-Plus-HA-subscription - **Resource group** – NGINX-Plus-HA - - **Virtual machine name** – ngx-plus-1 + - **Virtual machine name** – ngx-plus-1 ngx-plus-1 +For Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer, you’ll need six VMs. - The value ngx-plus-1 is one of the six used for VMs in [Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer]({{< ref "high-availability-standard-load-balancer.md" >}}). See Step 7 below for the other instance names. + The value ngx-plus-1 is one of the six machines. See Step 7 below for the other values. - **Region** – (US) West US 2 - **Availability options** – No infrastructure redundancy required - This option is sufficient for a demo like the one in this guide. For production deployments, you might want to select a more robust option; we recommend deploying a copy of each VM in a different Availability Zone. For more information, see the [Azure documentation](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview). + This option is best for a demo like the one in this guide. For production deployments, position a copy of each VM in a different Availability Zone. For more information, see the [Azure documentation](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview). - **Image** – Ubuntu Server 18.04 LTS - **Azure Spot instance** – No - **Size** – B1s (click Select size to access the Select a VM size window, click the **B1s** row, and click the  Select  button to return to the **Basics** tab) - **Authentication type** – SSH public key - **Username** – nginx_azure - - **SSH public key source** – Generate new key pair (the other choices on the drop‑down menu are to use an existing key stored in Azure or an existing public key) + - **SSH public key source** – Generate new key pair +(If you don’t want to generate a new key pair, use the existing key stored in your Azure account or an existing public key) - **Key pair name** – nginx_key - **Public inbound ports** – Allow selected ports - **Select inbound ports** – Select from the drop-down menu: SSH (22) and HTTP (80), plus HTTPS (443) if you plan to configure NGINX and NGINX Plus for SSL/TLS @@ -71,32 +74,38 @@ In addition, to install NGINX software by following the linked instructions, you screenshot of 'Basics' tab on Azure 'Create a virtual machine' page -5. If you are creating VMs to use in [Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer]({{< ref "high-availability-standard-load-balancer.md" >}}), the two NGINX Plus VMs in that deployment must have public IP addresses with SKU type **Standard** instead of the default **Basic**. +5. For [Active-Active HA for NGINX Plus on Microsoft Azure]( https://docs.nginx.com/nginx/deployment-guides/microsoft-azure/high-availability-standard-load-balancer/): - For simplicity, we recommend allocating **Standard** public IP addresses for all six VMs used in the deployment. At the time of initial publication of this guide, the hourly cost for six such VMs was only $0.008 more than for six VMs with Basic addresses; for current pricing, see the [Microsoft documentation](https://azure.microsoft.com/en-us/pricing/details/ip-addresses/). + Two major virtual machines run NGINX Plus behind an Azure Load Balancer. And both VMs require **Standard** SKU public IP addresses. By default, Azure assigns **Basic** SKU IPs. So, you must manually change this during VM setup. - To allocate a **Standard** public IP address, open the **Networking** tab on the **Create a virtual machine** window. Click Create new below the **Public IP** field. In the Create public IP address column that opens at right, click the **Standard** radio button under **SKU**. You can change the value in the **Name** field; here we are accepting the default created by Azure, ngx-plus-1-ip. Click the  OK  button. +To avoid errors, assign **Standard** public IP addresses to the VMs you’ll use in the deployment. Depending on your work load, you might need up to 6 VMs. +Follow these steps: + - Open the **Networking** tab on the **Create a virtual machine** window. + - Click Create new below the **Public IP** field. + - In the **Create public IP address column** that opens, click the **Standard Radio button** under **SKU**. + - In the **Name** field, accept the default created by Azure, ngx-plus-1-ip. + - Click the Ok  button. - screenshot of 'Networking' tab on Azure 'Create a virtual machine' page +When this guide was first published, the hourly cost for the six VMs was only $0.008. And this costlier than VMs with basic IP addresses. For current pricing, see the [Microsoft documentation](https://azure.microsoft.com/en-us/pricing/details/ip-addresses/). -6. At this point, you have the option of selecting nondefault values on the **Disks**, **Networking**, **Management**, **Advanced**, and **Tags** tabs. For a demo like the one in this guide, for example, selecting Standard HDD for OS disk type on the **Disks** tab saves money compared to the default, Premium SSD. You might also want to create or apply tags to this VM, on the **Tags** tab. + screenshot of 'Networking' tab on Azure 'Create a virtual machine' page - When you have completed your changes on all tabs, click the  Review + create  button at the bottom of the **Create a virtual machine** page. +6. Here, you can select non-default values on the **Disks**, **Networking**, **Management**, **Advanced**, and **Tags** tabs. By default, Azure assigns **Premium SSD** for the OS disk on the disk tab, but you can choose a cheaper option like **Standard HDD**. - If all of your settings are valid, a summary of them appears under the **Validation passed** banner, as in the following screenshot. + After you've completed your changes, click the  Review + create  button at the bottom of the **Create a virtual machine** page. - To change any settings, open the appropriate tab. If the settings are correct, click the  Create  button. + You’ll find a summary of your setting under the **Validation passed** banner. Ensure they’re suitable. Then, click on  Create  - If you chose in [Step 4](#create-vm_Basics) to generate a new key pair, a Generate new key pair window pops up. Click the  Download key and create private resource  button. + If you generated a new key pair in [Step 4](#create-vm_Basics), a Generate new key pair window pops up. Click on  Download key and create private resource  button. screenshot of validation message on Azure 'Create a virtual machine' page - It takes a few minutes for a VM to deploy. When it's ready, a summary of associated resources appears, as in the following screenshot. + VM deployment only takes a few minutes. After that, you’ll get a summary of your resources. Just like in the following screenshot. screenshot of Azure 'CreateVM-Canonical' page -7. If you are following these instructions to create the six VMs used in [Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer]({{< ref "high-availability-standard-load-balancer.md" >}}), their names are as follows: +7. If you’re creating 6 VMs for [Active-Active HA for NGINX Plus on Microsoft Azure Using the Azure Standard Load Balancer]( https://docs.nginx.com/nginx/deployment-guides/microsoft-azure/high-availability-standard-load-balancer/), use the following names: - ngx-plus-1 - ngx-plus-2 @@ -105,44 +114,44 @@ In addition, to install NGINX software by following the linked instructions, you - ngx-oss-app2-1 - ngx-oss-app2-2 - For ngx-plus-2, it is probably simplest to repeat Steps 2 through 6 above (or purchase a second prebuilt VM in the [Microsoft Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=NGINX%20Plus)). +For ngx-plus-2 (2nd NGINX Plus VM), repeat Steps 2 to 6 above or get a pre built VM from the [Microsoft Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=NGINX%20Plus)). - For the NGINX Open Source VMs, you can create them individually using Steps 2 through 6. Alternatively, create them based on an Azure image. To do so, follow Steps 2 through 6 above to create a source VM (naming it nginx-oss), [install the NGINX Open Source software](#install-nginx) on it, and then follow the instructions in [Optional: Creating an NGINX Open Source Image](#create-nginx-oss-image). + NGINX Open Source VMs gives you two options: create each VM manually by following steps 2 to 6. Or, make one template VM (named nginx-oss), [install the NGINX Open Source software](#install-nginx) on it, and clone that VM into three more copies using Azure image. For that, follow the instructions in [Optional: Creating an NGINX Open Source Image](#create-nginx-oss-image). ## Connecting to a Virtual Machine -To install and configure NGINX Open Source or NGINX Plus on a VM, you need to open a terminal window and connect to the VM over SSH. +To install and configure NGINX Open Source or NGINX Plus on a VM, open a terminal window and connect to the VM over SSH. Do like so: -1. Navigate to the **Virtual machines** page on the Azure dashboard and click the VM's name in the **Name** column of the table. +1. Go to the **Virtual machines** page on the Azure dashboard and click the VM's name in the **Name** column of the table. screenshot of Azure 'Virtual machines' page with list of VMs -2. On the page that opens (ngx-plus-1 in this guide), note the VM's public IP address (in the Public IP address field in the right column). +2. On the page that opens (ngx-plus-1 in this guide), note or write down the VM's public IP address (in the Public IP address field in the right column). screenshot of details page for 'ngx-plus-1' VM in Azure -3. Run this command to establish an SSH connection to the VM: +3. Run this command to confirm an SSH connection to the VM: ```shell ssh -i @ ``` - where + Note: - - `` is the name of the file containing the private key paired with the public key you entered in the SSH public key field in Step 4 of _Creating a Microsoft Azure Virtual Machine_. - - `` is the name you entered in the **Username** field in Step 4 of _Creating a Microsoft Azure Virtual Machine_ (in this guide it is nginx_azure). + - `` contains the private key paired with the public key you entered in the SSH public key field in Step 4 of _Creating a Microsoft Azure Virtual Machine_. + - `` is the name you entered in the **Username** field in Step 4 of _Creating a Microsoft Azure Virtual Machine_. In this guide, it is nginx_azure). - `` is the address you looked up in the previous step. ## Installing NGINX Software -Once you have established a connection with an instance, you can install the NGINX software on it. Follow the instructions in the NGINX Plus Admin Guide for NGINX Open Source and [NGINX Plus]({{< ref "nginx/admin-guide/installing-nginx/installing-nginx-plus.md" >}}). The [Admin Guide]({{< ref "/nginx/admin-guide/" >}}) also provides instructions for many maintenance tasks. +After you’ve successfully connected to your Azure VM, you can install the NGINX software on it. Follow the instructions in the NGINX Plus Admin Guide for NGINX Open Source and [NGINX Plus](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/). The [Admin Guide](https://docs.nginx.com/nginx/admin-guide/) has several maintenance instructions, too. ### Automating Installation with a Configuration Manager -You can automate the installation of NGINX Open Source and NGINX Plus. Instructions for Ansible are provided below. For Chef and Puppet, see these articles on the NGINX blog: +You can automatically install NGINX Open Source and NGINX Plus with Ansible. The instructions are provided below. For Chef and Puppet, see the following articles on the NGINX blog: - [Installing NGINX and NGINX Plus with Chef](https://www.nginx.com/blog/installing-nginx-nginx-plus-chef/) - [Deploying NGINX Plus for High Availability with Chef](https://www.nginx.com/blog/nginx-plus-high-availability-chef/) @@ -151,11 +160,11 @@ You can automate the installation of NGINX Open Source and NGINX Plus. Instruct #### Automating Installation with Ansible -NGINX publishes a unified Ansible role for NGINX Open Source and NGINX Plus on [Ansible Galaxy](https://galaxy.ansible.com/nginxinc/nginx/) and [GitHub](https://github.com/nginxinc/ansible-role-nginx). Perform these steps to install and run it. +NGINX provides automatic setup files for Open Source and Plus versions on [Ansible Galaxy](https://galaxy.ansible.com/nginxinc/nginx/) and [GitHub](https://github.com/nginxinc/ansible-role-nginx). Follow these steps to install and run: 1. [Connect to the VM](#connect-vm). -2. Install Ansible. These commands are appropriate for Debian and Ubuntu systems: +2. Install Ansible. These commands are suitable for Debian and Ubuntu systems: ```shell apt update @@ -169,7 +178,7 @@ NGINX publishes a unified Ansible role for NGINX Open Source and NGINX Plus on ansible-galaxy install nginxinc.nginx ``` -4. (NGINX Plus only) Copy the nginx-repo.key and nginx-repo.crt files provided by NGINX to ~/.ssh/ngx-certs/. +4. For NGINX Plus only: Copy the nginx-repo.key and nginx-repo.crt files provided by NGINX to ~/.ssh/ngx-certs/. 5. Create a file called **playbook.yml** with the following contents: @@ -181,7 +190,7 @@ NGINX publishes a unified Ansible role for NGINX Open Source and NGINX Plus on - role: nginxinc.nginx ``` -5. Run the playbook: +6. Run the playbook: ```shell ansible-playbook playbook.yml @@ -190,24 +199,24 @@ NGINX publishes a unified Ansible role for NGINX Open Source and NGINX Plus on ## Optional: Creating an NGINX Open Source Image -To streamline the process of installing NGINX Open Source on multiple VMs, you can create a Microsoft Azure image from an existing NGINX Open Source VM, and spin up additional instances of the image when needed. +If you've installed NGINX Open Source correctly on one VM, and saved it as an Azure template, you can make more copies without following long installation processes. Follow these steps: 1. [Install NGINX Open Source](#install-nginx) on the source VM, if you haven't already. -2. Navigate to the **Virtual machines** page, if you are not already there. +2. Navigate to the **Virtual machines** page. -2. In the list of VMs, click the name of the one to use as a source image (in this guide, we have called it ngx-oss). Remember that NGINX Open Source needs to be installed on it already. +2. In the list of VMs, click your preferred one to use as a source image (in this guide, we have called it ngx-oss). Remember that NGINX Open Source must be installed on it already. 3. On the page than opens, click the **Capture** icon in the top navigation bar. screenshot of details page for 'nginx-oss' VM in Azure -4. On the **Create image** page that opens, take note of the informational and warning banners and take any necessary action. Note in particular that if you use one of the VMs you created in [Creating a Microsoft Azure Virtual Machine](#create-vm) as the source for the image, you will need to re‑create a VM with that name. +4. On the Create image page, observe and comply with the warnings. If you use one of the VMs you created in [Creating a Microsoft Azure Virtual Machine](#create-vm) as the source for the image, you will need to re‑create a VM with that name. Then select the following values: - **Name** – Keep the current value. - - **Resource group** – Select the appropriate resource group from the drop‑down menu. Here it is NGINX-Plus-HA. + - **Resource group** – Select the appropriate resource group from the drop‑down menu. Here, it is NGINX-Plus-HA. - **Automatically delete this virtual machine after creating the image** – We recommend checking the box, since you can't do anything more with the image anyway. - **Zone resiliency** – On. - **Type the virtual machine name** – Name of the source VM (ngx-oss in this guide). @@ -218,9 +227,9 @@ To streamline the process of installing NGINX Open Source on multiple VMs, you c ### Creating a VM from the Image -It takes a few moments for the image to be created. When it's ready, you can create VMs from it with NGINX Open Source already installed. +An Azure image takes only a few moments to deploy. When it’s ready, you can create VMs from it with NGINX Open Source already installed. -1. Navigate to the **Images** page. (One method is to type images in the search box in the Microsoft Azure header bar and select that value in the **Services** section of the resulting drop‑down menu.) +1. Navigate to the Images page. To find it, type “images” in the Azure search bar. Then select Images from the services drop down. screenshot of Azure 'Images' page @@ -228,7 +237,7 @@ It takes a few moments for the image to be created. When it's ready, you can cre screenshot of details page for Azure 'ngx-plus-1-image' image -The **Create a virtual machine** page that opens is the same as in Step 4 of Creating a Microsoft Azure Virtual Machine, except that some fields have hardcoded values derived from the image and the **Image** field has the name of the image instead of an operating system. Return to that [step](#create-vm_Basics) to complete the VM creation. +The **Create a VM** page looks like Step 4 in Creating a Microsoft Azure Virtual Machine, but some fields are pre-filled from your image. The **Image** field now shows the image name instead of an OS. Go back to that [step](#create-vm_Basics) to finish creating your VM. ### Revision History