You can use AWS CloudFormation to specify license configuration rules within the templates. Deployments using these templates are tracked using License Manager. You can enforce rules on AWS CloudFormation templates by specifying one or more license configuration ARNs in the License Configurations field.
We are going to use SQL Server license configuration that we have setup initially for this walkthrough.
SQL Server 2016 Standard license configuration
License Manager Rule | Settings |
---|---|
License counting type | License Type is set to vCPU |
License count | Number of vCPUs set to 8 |
Minimum / Maximum vCPUs | Minimum vCPU 4 / Max vCPU8 |
License count hard limit | Enforce license limit = Yes |
Allowed tenancy | Tenancy = Default (shared) |
In order to configure AWS Cloudformation template to use the SQL Server 2016 Standard policy, we need to retrieve the License Configuration ARN.
To retrieve the License configuration ARN via console
You can also use the AWS CLI to retrieve a list of all the license configurations. In order to use this command, ensure you have setup the AWS CLI
appropriately and you have set the appropriate credentials for your account and have specified the region as well in AWS_DEFAULT_REGION.
In the example below the output is redacted to save a space.
aws license-manager list-license-configurations
{
"LicenseConfigurations": [
{
"LicenseConfigurationId": "lic-xxxxx",
"LicenseConfigurationArn": "<<License_Configuration_Arn>>",
"Name": "SQL Server 2016",
"LicenseCountingType": "vCPU",
"LicenseRules": [
"#honorVcpuOptimization=true"
],
"LicenseCount": 4,
"LicenseCountHardLimit": false,
"ConsumedLicenses": 0,
"Status": "AVAILABLE",
With the license configuration ARN, we are going to change one of the CloudFormation templates that we used in the beginning of the workshop and specify the license configuration(s) that we want to use.
You can download the CloudFormation stacks here: Oracle and SQL Server.
The AWS CloudFormation EC2 Instance resource type allows you to specify a collection of License Specifications that you can use to enforce the desired license configuration.
Below you can see how to configure AWS CloudFormation template to use a license configuration - in this example we are using the SQL Server template recently downloaded:
Properties:
ImageId: !FindInMap
- RegionMap
- !Ref 'AWS::Region'
- WindowsAMI
InstanceType: t3.xlarge
Monitoring: 'true'
DisableApiTermination: 'false'
IamInstanceProfile:
Ref: SSMInstanceProfile
LicenseSpecifications:
- LicenseConfigurationArn: <<Replace_with_License_Configuration_ARN>>
We’ve added a new property called LicenseSpecifications and within this property we set which license configuration we wanted to use for that specific Amazon EC2 instance.
Once you’ve saved your change on the CloudFormation template, you can create a new stack using it.