AWS Cloud Operations Blog

Track licenses across multiple AWS Regions using AWS License Manager

Are you a license administrator who wants to manage software licenses from different vendors as you build your cloud infrastructure across multiple AWS Regions? If so, you can use AWS License Manager to gain control and visibility into license usage. In this blog post, we discuss a solution that integrates AWS License Manager with AWS Lambda to manage licenses used across different AWS Regions.

Solution overview

In each of the AWS Regions, you create a license configuration that contains licensing rules based on the terms of your enterprise agreements.

A Lambda function is used to call License Manager API operations, GetLicenseConfiguration and ListUsageForLicenseConfiguration, which provide license consumption details. This Lambda function is triggered at regular intervals based on your administration policy by an Amazon EventBridge rule. That interval can be weekly, daily, or at any given time intervals. The result of the Lambda function is then stored in an Amazon Simple Storage Service (Amazon S3) bucket. The following figure shows the solution design.

License configurations in multiple Regions. Lambda function is triggered by an EventBridge time-based event to store license consumption details in an S3 bucket.Figure 1: Architecture diagram of multi-Region license tracking solution

Prerequisites

To deploy the solution described in this post, you need the following:

Deployment steps

Use the AWS CloudFormation template to deploy the solution.

1. In the AWS CloudFormation console, choose Create stack, and then choose the With new resources (standard) option.

Figure 2: Stacks page in the AWS CloudFormation console

2. Save the code snippet from aws-samples repo as a YAML file on your local computer.
3.  On the Create stack page, choose Template is ready, choose Upload a template file, and then choose Next.
4. On the Specify stack details page, provide the following details, and then choose Next:

  • Stack name: Enter a stack name for your AWS CloudFormation stack. In this post, we used MultiRegionLicenseTracking.
  • LambdaTriggerSchedule: Enter the schedule expression for the EventBridge rule based on your administration policy. We chose rate(1 day), which triggers the Lambda function daily. For more information, check Cron Expressions  in the Amazon EventBridge documentation.
  • LicenseConfigArns: Enter the list of license configuration ARNs, separated by comma.

MultiRegionLicenseTracking appears in the Stack name field. In the Parameters section, rate(1 day) appears in the LambdaTriggerSchedule field. In LicenseConfigArns, a list of ARNs is displayed, separated by commas.Figure 3: Specify stack details page

5. (Optional) Configure the fields for tags, permissions, and other advanced options. If no changes are required, use the defaults, and then choose Next.

Enabled is selected for the Rollback on failure option. Disabled is selected for the Termination protection option. The Timeout field is left blank.Figure 4: Stack creation options

6. Review the stack details and in the Capabilities section, select I acknowledge that AWS CloudFormation might create IAM resources, and then choose Create stack.

Stack creation options displays a summary. The IAM check box is selected.Figure 5: IAM check box

7. On the stack details page, you can check the status of your stack. When all the resources defined in the CloudFormation template have been created, CREATE_COMPLETE is displayed under Status.

On the MultiRegionLicenseTracking stack details page, the stack ID, description, status, and created time is displayed. The status is CREATE_COMPLETE.Figure 6: CREATE_COMPLETE

8. Under Resources, you should find the following four resources have been created.

  • LicenseTrackingLambdaFunction: The Lambda function that calls License Manager to fetch the license consumption of license configurations whose ARNs were provided as input to the CloudFormation parameter.
  • LicenseManagerLambdaEventRule: The Amazon EventBridge rule that triggers the Lambda function on a periodic schedule.
  • LambdaRole: The IAM role with the permissions required for the Lambda function to make License Manager API calls and store the function results in an S3 bucket.
  • LicenseConsumptionBucket: The S3 bucket used for storing multi-Region license consumption details.

Under Resources, LambdaRole, LicenseConsumptionBucket, LicenseManagerLambdaEventRule, and LicenseTrackingLambdaFunction are displayed.Figure 7: Resources created by the AWS CloudFormation stack

Now that the solution is deployed, let us discuss the data that is sent to the Amazon S3 bucket on every Lambda function run. When the EventBridge Rule triggers the Lambda function, the Lambda function creates the following folder structure and files in the S3 bucket.

  • A folder structure in the format YYYY/MM/DD/Timestamp for each run, as shown here:

License consumption report folder structure in format yyyy/mm/dd/timestamp. The page displays a Folder overview section (Region, URI, ARN) and an Objects section.Figure 8: License consumption report folder structure

  • A license consumption summary file with details of all the license configurations that are sent as parameters to the CloudFormation template. In addition to the summary, for each of the license configurations, individual usage files are created that provide information of licenses consumed.

In the Objects section, .csv files (individual usage files) are displayed.

Figure 9: License consumption reports from multiple AWS Regions

You can use these details to track consumption across AWS Regions and assess your license monitoring needs.

Cleanup

To avoid ongoing charges, delete the CloudFormation stack. That deletes the resources deployed by the CloudFormation template. You must empty the S3 bucket before you can delete it.

There is no additional charge for using License Manager. You pay only for the AWS resources that are managed by License Manager, based on the AWS pricing of the resources.

Conclusion

In this blog post, we showed you how to track licenses when your workloads are deployed in multiple AWS Regions. This solution makes it effortless to manage and monitor license administration with less operational overhead. For more information about license management solutions on AWS, check the AWS License Manager documentation.

 

About the Authors

Harshitha Putta is a Cloud Infrastructure Architect with AWS Professional Services in Seattle, WA. She is passionate about building innovative solutions using AWS services to help customers achieve their business objectives. She enjoys spending time with family and friends, playing board games and hiking.

 

 

Kalhan Vundela is a Software Development Engineer with Amazon Braket service. He is passionate about developing solutions that solve customer challenges. Kalhan enjoys hiking, skiing, and cooking.