AdvLab3: BYOL Licenses and Dedicated Hosts

Author: Dean Suzuki (Last Updated: 4/1/20)

Abstract

Many customers are interested in bringing their Microsoft Windows licenses (Bring Your Own License, BYOL) to the cloud. In many cases to do this action, the instances need to run on AWS Dedicated Hosts to be compliant with Microsoft licensing. For more details, please see: https://aws.amazon.com/windows/faq/

In this hands-on lab, you will learn:

  • How to use License Manager to help manage your Microsoft licenses.

  • How to leverage Host Resource Groups to help manage Dedicated Hosts.

Prerequisites

This lab relies upon:

  • The ability to launch a Dedicated Host. Check AWS Service Quotas to verify that you can launch a Dedicated Host instance. In the lab, you will create a M4 dedicated host. If you have the ability to create a dedicated host of a different instance type, then use that instance type in the lab.
  • Having the BYOL AMI image in your account.

Section 1: Need a BYOL Image

To bring your own license to AWS, you need to create the Windows image and import it into AWS. AWS Service Migration Service (SMS, see here) or VM Import/Export tool (see here) can be used to import your Windows image into AWS. You cannot use an Amazon Machine Image (AMI) since they use the Amazon Windows licenses. In this section, a BYOL image has been shared with your AWS account. You will create a copy of the image in your AWS account.

  1. In the EC2 console on the left hand navigation, go to Instances.

  2. Select Launch Instance.

  3. On Step 1, select My AMI’s and below that under Ownership, select Shared with me.

  4. You should see a BYOL-Windows-Image that has been shared with your account. Press Select.

  5. On Step 2, select M4.large. Press Next.

  6. On Step 3, press Next.

  7. On Step 4, press Next.

  8. On Step 5: Add Tags, press Add Tag. For Key, enter Name. For Value, enter BYOL-Image. Press Next.

  9. On Step 6: Configure Security Group on the Source field, change Custom to My IP. Press Review and Launch.

  10. On Step 7, press Launch.

  11. For Key Pair, choose an existing key pair if you have a key pair from an earlier lab or create a new key pair if you do not have a key pair. Be sure to remember where you download the key pair if you create a new key pair. Click Launch Instance.

  12. Click View Instances.

  13. Wait for the instance state to turn to running and Status 22 checks to complete. It should take a couple minutes to complete.

  14. Once the instance comes online, select it and go to Actions > Instance State > Stop.

  15. Once the instance stops, select it and go to Actions > Image > Create Image.

  16. On the Create Image screen for Image name, enter BYOL-Windows-Image. Press Create Image button.

  17. In the EC2 console on the left hand navigation, click AMIs. You should see your newly created AMI.

In this process, you created a local copy of the Windows BYOL image in your AWS account.

Section 2: Create a licensing rule in License Manager

In this section, you will learn how to create a licensing rule in License Manager to help you keep track of your Windows licenses that you are using in AWS.

  1. Login to the AWS Console and go to the License Manager console by searching for License Manager in the search.

  2. Click Start using AWS License Manager (if it shows).

  3. Check “I grant AWS License Manager … “ which will allow License Manager to create the IAM policies that it needs to operates. Press Grant permissions.

  4. Select Create license configuration.

  5. On the Create license configuration screen,

    a. For License configuration name, Windows-Server-BYOL-License

    b. For Description, enter a description for the rule (e.g. Used to keep track of Windows Datacenter licenses)

    c. For License type, select Cores. Notice the types that are available.

    d. For Number of Cores, enter 300. In this example, we are assuming that you own 300 cores of Windows server licenses.

    e. For Enforce license limit, leave it unchecked. Note, that if you checked this box, then if someone tries to launch an instance and it would exceed the amount of licenses that you had, then AWS would block the launch of that instance.

    f. For Rules – optional, expand the options and review the different additional rule constraints that you can apply. For example, some Microsoft licensing requires a minimum core count. You are not going to set any of these options in the lab, but we wanted to make you aware of these options.

  6. For Production information – optional, review the available options. These fields enable License Manager to automatically apply this licensing rule to instances that match this product name. We are not going to set any of these options in the lab, but wanted to highlight the field.

  7. Press Submit.

Next, you are going to associate the Windows BYOL AMI that you reviewed in Section 1 with this licensing rule that you just created.

  1. In the License configurations list, select the licensing rule that you just created. Then, go to the Actions menu and select Associate AMI.
  2. Select the BYOL-Windows-Image AMI and then press the Associate button.

By associating the AMI with the licensing rule, anytime a new instance is created using the AMI, the licensing rule will keep track of the license usage. If we enabled the enforce option, the licensing rule could also block any new instances from being created, if the creation would exceed the amount of licenses owned.

Section 3: Creating Host Resource Groups

To simplify the management and usage of dedicated hosts, AWS created a function called host resource group. A host resource group is a collection of Dedicated Hosts that you can manage as a single entity. As you launch instances, License Manager allocates the hosts and launches instances on them based on the settings that you configured. As you terminate instances, if all the instances on a dedicated host are terminated, then AWS will automatically release the dedicated host.

Also, if you are using an AWS Organization, then AWS Resource Access Manager allows you to share host resource groups across AWS accounts. This improves the utilization of dedicated hosts and could reduce costs since now you can share the usage of dedicated hosts across AWS accounts.

See the Host Resource Group documentation for more information (here).

In this section, you will create a host resource group.

  1. In the License Manager console on the left hand navigation, select Host resource groups.

  2. Select Create host resource group button.

  3. In the Create host resource group screen,

    a. For Host resource group name: Windows-BYOL-HRG

    b. For EC2 Dedicated Host management settings, review the settings. We are not changing any of them. Please note that there is an option to Share host resource group with all my member accounts. This capability allows you to share dedicated hosts across accounts. See here for more information.

  4. For Associated license configurations, select the “Windows-Server-BYOL-License” that you created earlier.

  5. Press Create.

Section 4: Creating instances on the dedicated hosts

In this section, you will create a new instance using the Windows BYOL AMI that you created earlier. Then you will notice that AWS allocates a dedicated host to run the instance on.

First, you are going to check if any dedicated hosts are currently running in the account.

  1. In the AWS Console, go to the EC2 console.

  2. In the left navigation, select Dedicated Hosts.

  3. You will notice that there are no dedicated hosts created running in the account. Next, you will create an instance.

  4. In the left navigation of the EC2 console, click Instances.

  5. Click Launch instance.

  6. On the Step 1 screen on the left navigation, select My AMIs.

  7. Select the BYOL-Windows-Image and press Select.

  8. On the Step 2 screen, search for m4.large and select the instance. Press Next.

  9. On the Step 3 screen,

    a. For Tenancy, select Dedicated host – Launch this instance on a dedicated host.

    b. For Host resource group, click Launch instance into a host resource group.

    c. For Host resource group name, select the host resource group that you created earlier (e.g. Windows-BYOL-HRG)

    d. For the remaining parameters, leave at default.

    e. Press Next.

  10. On the Step 4 Add Storage screen, press Next.

  11. On the Step 5 Add Tags screen,

    a. Press Add Tag

    b. For Key, enter Name.

    c. For value, enter WindowsBYOL1.

    d. This will set the instance’s name in the console.

    e. Press Next.

  12. On the Step 6 Security group screen, change Source to My IP.

  13. Press Review and Launch.

  14. On Step 7, press Launch.

  15. Select Choose an existing key pair and select the one that you used earlier.

  16. Press Launch Instances.

  17. Click View Instances.

  18. Wait for the instance state to turn to running and Status 22 checks to complete. It should take a couple minutes to complete. Note the instance id of your new instance.

  19. In the left navigation, select Dedicated Hosts. Notice that AWS has allocated a dedicated host.

  20. Click on the dedicated host link under Host id.

  21. In the dedicated host details, note the number of physical cores that the new host is using (48) and the vCPU utilization which is the vCPU that your new instance is using (2)

  22. In the Running Instances area, note that your newly created instance is running on the dedicated host.

  23. Open the console in a new tab License Manager and click License configurations in the left navigation.

  24. Notice on the Windows-Server-BYOL-License configuration rule that the licenses consumed are 48 of 300. License Manager is keeping track of the number of Windows licenses that you are using when you allocated the dedicated host.

  25. Go back to the EC2 console. You are now going to terminate the EC2 instance and notice how AWS will release the dedicated host.

  26. Select Instances in the left navigation. Select your WindowsBYOL1 instance and go to Actions > Instance State > Terminate.

  27. On the Terminate instances confirmation screen, select Yes, Terminate.

  28. Wait for the instance state to go to Instance state. It may take a couple minutes.

  29. Once the instance is terminated, click on Dedicated Hosts in the left navigation. After a couple minutes, you will see that the host has been Released.

Congratulations!

In this lab, you have learned how to:

  • Create a new Windows AMI

  • Create License Configurations rules in License Manager

  • Create Host Resource Groups to managed dedicated hosts

  • Create and terminate instances using the dedicated hosts in a host resource group

  • Use host resource groups to simplify the management of dedicated hosts