AWS Cloud Operations Blog

Use AWS License Manager API operations to manage your software licenses in the cloud

The simplified Bring Your Own License (BYOL) experience in AWS License Manager allows you to effectively manage your own software licenses in AWS. These licenses can be used with Amazon Elastic Compute Cloud (Amazon EC2) shared tenancy, EC2 Dedicated Hosts, Amazon RDS, AWS Marketplace, or an on-premises environment. License Manager helps you manage your software licenses, including Microsoft Windows Server and Microsoft SQL Server licenses. License administrators can automate license management by building custom dashboards and track licenses centrally using License Manager API operations.

Solution tutorial

In this blog post, I walk you through the following scenarios.

  • Scenario 1: Using License Manager API operations to track your license usage across Amazon EC2.
  • Scenario 2: Using License Manager API operations to manage BYOL Oracle licenses for databases running on Amazon RDS for Oracle.
  • Scenario 3: Using License Manager API operations to track Windows Server and SQL Server licenses on EC2 Dedicated Hosts.
  • Scenario 4: Using License Manager API operations to track your license usage across on-premises servers.

Scenario 1: Using License Manager API operations to track your license usage across Amazon EC2.

If you have Amazon EC2 instances consuming software licenses before you set up the license configuration, make sure that these instances are managed by AWS Systems Manager.

The instances will be managed by Systems Manager. Associate the license configuration to the discovered instances so License Manager can track the license usage.

Now for or this scenario, I have the software installed and licensed in an Amazon Machine Image (AMI).

Step 1

To create the license configuration, use the create-license-configurationAPI in the AWS CLI. The license configuration specifies how your licenses should be counted (for example, by vCPUs or number of instances). The license configuration in this scenario specifies vCPUs as the counting model for license usage. For information, check create-license-configuration in the AWS CLI command reference.

$ aws license-manager create-license-configuration \
--name license-configuration-tracking-XYZLicense \
--license-counting-type vCPU \
--license-count 6

Step 2

Use the update-license-specifications-for-resource API operation to associate the license configuration you created in Step1 to the AMI. Replace the resource name in --resource-arn with the ARN of the existing EC2 instance. For information, check update-license-specifications-for-resource in the AWS CLI command reference.

$ aws license-manager update-license-specifications-for-resource \
--resource-arn arn:aws:ec2:us-west-2::image/ami-00cXXXXXXXXXXX14f \
--add-license-specifications LicenseConfigurationArn=arn:aws:license-manager:us-west-2:90XXXXXXX930:license-configuration:lic-18ba608184961fd50ad6b405ffb6a5b5

Step 3

Now that the license configuration is ready, you can use the run-instances API to launch a new EC2 instance from the AMI, which is configured with the license configuration. For information, check run-instance in the AWS CLI command reference.

$ aws ec2 run-instances \
--instance-type c5.2xlarge \
--image-id ami-00cXXXXXXXXXXX14f \
--subnet-id subnet-0fXXXXXXXXXXXXdcf

Step 4

When instances are launched using the AMI, you can now check how many licenses have been consumed. Use get-license-configuration to get license consumption details. For information, check get-license-configuration in the AWS CLI command reference.

$ aws license-manager get-license-configuration \
--license-configuration-arn arn:aws:license-manager:us-west-2:90XXXXXXX930:license-configuration:lic-18ba608184961fd50ad6b405ffb6a5b5

Comparing the sum of consumedLicenses with licenseCount field of the output, you can find whether the total number of resources that are actively consuming the software license exceeds the number of available licenses.

Scenario 2: Using License Manager API operations to manage BYOL Oracle licenses for databases running on Amazon RDS for Oracle.

Step 1

First, use the create-license-configuration API operation to create a license configuration to track the number of Oracle licenses you own for databases running on Amazon RDS for Oracle. For information about the supported product types for Oracle database running on Amazon RDS, check create-license-configuration in the AWS CLI command reference.

Using the License Manager dashboard, you can also manage Oracle licenses for databases running on Amazon RDS across AWS accounts centrally. You create licensing rules in the management account, attach them to resources in member accounts, and track usage of licenses across AWS accounts.

In this scenario, we choose to track licenses used by Oracle databases running Enterprise Edition on Amazon RDS.

$ aws license-manager create-license-configuration \
--name license-configuration-oracle-byol \
--description 'This license configuration tracks the consumption of licenses  by Oracle database running Enterprise Edition in Amazon RDS' \
--license-counting-type vCPU \
--license-count 100 \
--product-information-list file://product_information.json

where the contents of product_information.json is as below,

[{
 "ResourceType": "RDS",
 "ProductInformationFilterList": [{
 "ProductInformationFilterName": "Engine Edition",
 "ProductInformationFilterValue": ["oracle-ee"],
 "ProductInformationFilterComparator": "EQUALS"}]}]

Step 2

On an ongoing basis, License Manager discovers which resources are used in your environment. The discovery of these resources is not immediate. It might take few minutes. After this resource usage update, License Manager reports the licenses used. For the purposes of this scenario, I followed the steps in creating an Oracle DB instance and connecting to a database on an Oracle DB instance. I set up Oracle Enterprise Edition running on Amazon RDS on t3.2xlarge, which has 8 vCPUs and 32 GiB of RAM. You can use the AWS CLI get-license-configuration command to get license consumption details. Note that this instance type is not included in the AWS Free Tier so you will incur charges.

If you want to list all license usage records for the selected license configuration, you can use the list-usage-for-license-configuration API operation. For information, check list-usage-for-license-configuration in the AWS CLI command reference.

$ aws license-manager get-license-configuration \
--license-configuration-arn arn:aws:license-manager:us-west-2:90XXXXXXX930:license-configuration:lic-86ba1b038d3a794dd8130ddbcf0ed8b3

Scenario 3: Using License Manager API operations to track Windows Server and SQL Server licenses on EC2 Dedicated Hosts.

In this scenario, I show you how the BYOL feature in License Manager simplifies the management of your own software licenses. There are licenses for Windows and SQL Server, that require a dedicated physical server. AWS License Manager is integrated with Amazon EC2 Dedicated Host. In License Manager, you can specify your licensing terms for governing license usage and your Dedicated Host management preferences for host allocation and host capacity utilization. After the setup, AWS takes care of these administrative tasks on your behalf. You can seamlessly launch VMs (instances) on Dedicated Hosts same as how you would launch an EC2 instance with AWS-provided licenses.

Step 1

Use create-license-configuration to create a license configuration to track the number of licenses you own (in this example, for Windows Server).

$ aws license-manager create-license-configuration \
--name lc-win-byol --description 'This license configuration tracks the consumption of my Windows server licenses' \
--license-counting-type Core \
--license-count 100 \
--license-rules #allowedTenancy=EC2-DedicatedHost

Step 2

Next, use the update-license-specifications-for-resource API operation to associate your AMI to the launch configuration you just created.

aws license-manager update-license-specifications-for-resource \
--resource-arn arn:aws:ec2:us-west-2::image/ami-0eXXXXXXXXXXXXef9  \
--add-license-specifications LicenseConfigurationArn=arn:aws:license-manager:us-west-2:90XXXXXXX930:license-configuration:lic-20ba1b8f56073f7f3e4e1c247b96dfda

Step 3

After you have created license configurations and associated them with the AMI, use the AWS License Manager console to create a host resource group and associate it with the license configuration. Because you are using only those licenses on hosts that belong to this group, choose the license configurations you created earlier. For more information, check create a host resource group in the AWS License Manager documentation. As of the writing of this blog post, you cannot use the API to create a host resource group.

Picture showing host resource group in the AWS License Manager console
Figure 1: Host resource groups page of the AWS License Manager console

After the host resource group is created and configured, you can launch instances using their AMI. AWS places instances on an automatically allocated host inside the HRG-lc-dedicated_capacity host resource group.

Step 4

Now that you have created a host resource group and associated license configurations, use the run-instances API operation to launch a new EC2 instance from the AMI to which the license configurations are attached.

aws ec2 run-instances \
--instance-type c5.2xlarge \
--image-id ami-0eXXXXXXXXXXXXef9  \

--subnet-id subnet-0fdb525e9a09a6dcf

Note:  If there is only one host resource group mapped to associated host-based (core/socket) licenses, you do not need to reference a host resource group name in the run-instances call. For more information, check the simplified Bring-Your-Own-License experience using AWS License Manager blog post written by my colleague, Harshitha Putta, where she discusses the automatic scaling of Dedicated Hosts with BYOL licenses.

Step 5

Now, monitor the license consumption on the EC2 Dedicated Hosts. Use the list-usage-for-license-configuration API to list all license usage records for the selected license configuration and then choose the host ID (prefixed with h-) from the ResourceArn: field. The host ID is the dedicated host-level information on which the resources consuming your licenses are located. For more information, check list-usage-for-license-configuration in the AWS CLI command reference. If you have not created the host resource group, the output of the API call is empty. Because I chose the automatic host allocation setting (check Figure 1) when I created the host resource group, a new host is allocated automatically during the launch of an EC2 instance.

aws license-manager list-usage-for-license-configuration \
--license-configuration-arn arn:aws:license-manager:us-west-2:90XXXXXXX930:license-configuration:lic-20ba1b8f56073f7f3e4e1c247b96dfda

You can use the describe-hosts API with the host ID as a parameter retrieved from the previous step. For more information, check describe-hosts in the AWS CLI command reference. This command lists instances that consume capacity, available free capacity, and other useful parameters of the specified Dedicated Host.

aws ec2 describe-hosts --host-ids h-043da20fa7d9f3a63

Depending on your EC2 Dedicated Host management settings in the host resource group, Amazon EC2 releases unused hosts on your behalf. An unused host has no running instances.

Scenario 4: Using License Manager API operations to track your license usage across on-premises servers.

If you have on-premises servers already consuming software licenses before you set up the license configuration, first make sure that those servers are managed by AWS Systems Manager (steps 1–5).

Step 1

Servers and VMs in the on-premises environment require an IAM role to communicate with Systems Manager. For more information, check create an IAM service role for a hybrid environment in the AWS Systems Manager documentation.

Step 2

To set up servers and VMs in your hybrid environment as managed instances, you must create a managed instance activation. For more information, check create a managed-instance activation for a hybrid environment in the AWS Systems Manager documentation.

Step 3

Install SSM Agent in your hybrid environment so your servers and VMs can communicate with Systems Manager. If you are installing SSM Agent on Linux machines in a hybrid environment, follow the documentation for SSM Agent installation for Linux OS. If you are installing SSM Agent on Windows machines in a hybrid environment, follow documentation for SSM Agent installation for Windows OS.

Step 4

The server or VM in the hybrid environment is now a managed instance and its name is prefixed with mi-. Use the AWS CLI describe-instance-information command to view managed instances.

$ aws ssm describe-instance-information

Step 5

Configure the Systems Manager inventory to collect metadata from your managed instances. For more information, check quickly configure your managed instances for inventory by using the AWS CLI in the AWS Systems Manager documentation.

$ aws ssm create-association --name AWS-GatherSoftwareInventory \
--targets Key=InstanceIds,Values=mi-0b482706db2c0e4eb \
--schedule-expression "rate(1 day)" \
--parameters applications=Enabled, awsComponents="Enabled,customInventory=Enabled, \
instanceDetailedInformation=Enabled, networkConfig=Enabled, \
services=Enabled, windowsRoles=Enabled, windowsUpdates=Enabled"

Step 6

Associate the license configuration to the managed instances so that License Manager can track the license usage in the hybrid environment. Create the license configuration before you attempt this step.

$ aws license-manager update-license-specifications-for-resource \
--resource-arn arn:aws:ssm:us-east-1:90XXXXXXX930:managed-instance/mi-0b482706db2c0e4eb \
--add-license-specifications LicenseConfigurationArn=arn:aws:license-manager:us-east-1:90XXXXXXX930:license-configuration:lic-b8b9621d7683cc59925c0f4aaf80d37d

Step 7

Use the get-license-configuration command to get license consumption details. For information, check get-license-configuration in the AWS CLI command reference.

$ aws license-manager get-license-configuration \
--license-configuration-arn arn:aws:license-manager:us-east-1:90XXXXXXX930:license-configuration:lic-b8b9621d7683cc59925c0f4aaf80d37d

Comparing the sum of consumedLicenses with licenseCount field of the output, you can find whether the total number of resources that are actively consuming the software license exceeds the number of available licenses.

Cleaning up

If you followed along and created AWS resources, we recommend that you clean up the environment if it is not required. You will incur charges for the Amazon RDS database instance type used in Scenario 2 because it exceeds what’s offered by the AWS Free Tier.

To do this cleanup, delete the Amazon RDS database created in Scenario 2 and then the instance launched in Scenarios 1 and 3. Shut down the active Dedicated Host created during Scenario 3. Finally, clean up the AWS License Manager configuration rules.

Conclusion

In this post, I showed you how to manage your software licenses on Amazon EC2, on-premises. We also discussed how managing BYOL licenses on Amazon RDS for Oracle, and Windows Server and SQL Server licenses on EC2 Dedicated Hosts has become easier with License Manager API operations. You can use AWS License Manager to manage software licenses from a variety of software vendors such as Microsoft, SAP, and IBM across AWS and on-premises environments. For simplicity, I showed the configuration in a single AWS account, but you can also use AWS License Manager to track software licenses across multiple AWS accounts. For more information, check the tracking software usage across multiple AWS accounts using AWS License Manager blog post. I encourage you to use what you have learned here to reduce the effort of managing licenses across your organization. You might start by using AWS License Manager in a small part of the organization to demonstrate a proof of concept to your peers.

Additional references

License Manager AWS CL Command Reference

Tracking your Oracle licenses using AWS License Manager

Simplified Bring-Your-Own-License experience using AWS License Manager

About the author

Blog author picture
Shree Chinnasamy is a technical account manager and is focused on driving operational excellence for his customers. An avid reader and a marathon finisher, Shree is based out of Washington in the pacific northwest.