When customers migrate workloads to the cloud, they can often substantially reduce costs by using their existing software licenses. AWS License Manager makes it possible for customers to allocate their existing licenses to their cloud-hosted workloads, enforce licensing rules to avoid falling out of compliance, and automate the tracking and management of the resources that consume these licenses. AWS License Manager also integrates with Amazon Elastic Compute Cloud (Amazon EC2) Dedicated Hosts so that customers can bring their own licenses for operating system and other software to AWS.
To use AWS License Manager to track the licenses you have allocated to your AWS environment, you will need to create license configurations, which define:
- The software product being tracked.
- The terms under which the license is tracked (by physical core, vCPU, and so on).
- The number of licenses.
- Any other rules that apply. These rules might include license affinity (the number of days a license must be applied to a resource before it can be moved to a different resource) or product installation restrictions (on Dedicated Host infrastructure only).
For migrations that only involve a handful of resources, it makes sense to use the AWS License Manager console to define these configurations. Customers who plan to migrate a lot of licenses might find that process too repetitive and time-consuming. It’s also possible to introduce errors as they transcribe data from license agreements into the console. AWS License Manager offers an API that can be used to automate this process.
Let’s consider a typical use case: You plan to migrate your existing Windows Server and SQL Server licenses and have received a statement from your Microsoft account team. A document like that might include a lot of information that’s difficult to understand. To ensure that this information is consistently tracked in AWS License Manager, you decide to automate the definition of your license configurations. You read this statement with code that calls AWS License Manager APIs to create the license configurations. You have created Amazon Machine Images (AMIs) for the software you have already installed in your on-premises environment. You generated these AMIs using AWS Server Migration Service and then created a mapping of which AMIs correspond to each software configuration.
Like most AWS services, AWS License Manager offers an SDK for interacting with the service APIs. In this use case, you used Python to build the automation and will use the AWS SDK for Python to interact with the service. The license statement is an Excel spreadsheet, so you used the open source openpyxl Python module to read this file in your code. Upon review of the statement, you will import your Windows Server and SQL Server licenses.
Note: Although creating licenses programmatically is much faster than using the console or AWS CLI, there is a chance that your API calls might exceed rate limits and AWS License Manager might throttle them. Depending on the language and SDK, you might have the SDK client implement retry logic for you or implement this logic yourself. For more information, see Error retries and exponential backoff in AWS in the AWS General Reference. You might also need to request a service limit increase for the number of licenses you can create.
The logic and code required to open and read the contents of an Excel spreadsheet in Python is beyond the scope of this blog post, but it’s available as a sample project on GitHub. In this code, we open the Excel spreadsheet and then proceed to iterate through the list of products. For each product, we make a call to the AWS License Manager
create_license_configuration API, which takes the same information that you supply when you use the console to create a license configuration: the name of the product, what the license tracks, the number of licenses, and any rules that further determine how the license is applied.
In our example, the type of license counting depends on whether the product is the Windows Server operating system (in which case we use the
Core counting type) or SQL Server (in which case we use the
vCPU counting type). Because we want our license limit to be enforced at launch time, we set
True. This checks the available license count, and if the new resource would exceed the number of allocated licenses, the request fails with an error message.
If you own enough SQL Server Enterprise licenses to license all of the cores on a Dedicated Host, the most economical option is to use AWS License Manager’s core-based license configuration and associate the licenses with a host resource group rather than use vCPUs.
After you define a license configuration, you might also want to associate the license with one or more of the previously imported AMIs. To perform this association, invoke the
update_license_specifications_for_resource API and provide the Amazon Resource Name (ARN) of the AMI and the ARN of the license configuration. By creating this association, any EC2 instances that are launched from the specified AMI will automatically be tracked by the license configuration. Be aware that after you create this association, you must first disassociate the AMI before you can delete the license configuration.
Customers who rely heavily on licensed software and want to ensure compliance can use AWS License Manager to help automate many of the steps required to properly track their license consumption. In this blog post, I shared an approach for automating the import of license information from a document such as a vendor’s license statement using the AWS License Manager API. When you use these APIs, you can accelerate the process of creating and configuring an environment that remains compliant with your software licenses.
You’re welcome to download and modify the sample code to suit your use case. Depending on the mechanism your vendor uses to track your licenses, you might need to parse CSV files, XML files, and so on.
About the author
|Andy Hopper is a Principal Specialist Solutions Architect at AWS, and specializes in helping customers migrate and modernize Microsoft .NET and Windows workloads into their AWS environment.|