interface AmiDistribution
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.AmiDistribution |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#AmiDistribution |
Java | software.amazon.awscdk.services.imagebuilder.alpha.AmiDistribution |
Python | aws_cdk.aws_imagebuilder_alpha.AmiDistribution |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป AmiDistribution |
The regional distribution settings to use for an AMI build.
Example
const distributionConfiguration = new imagebuilder.DistributionConfiguration(this, 'DistributionConfiguration', {
distributionConfigurationName: 'test-distribution-configuration',
description: 'A Distribution Configuration',
amiDistributions: [
{
// Distribute AMI to us-east-2 and publish the AMI ID to an SSM parameter
region: 'us-east-2',
ssmParameters: [
{
parameter: ssm.StringParameter.fromStringParameterAttributes(this, 'CrossRegionParameter', {
parameterName: '/imagebuilder/ami',
forceDynamicReference: true
})
}
]
}
]
});
// For AMI-based image builds - add an AMI distribution in the current region
distributionConfiguration.addAmiDistributions({
amiName: 'imagebuilder-{{ imagebuilder:buildDate }}',
amiDescription: 'Build AMI',
amiKmsKey: kms.Key.fromLookup(this, 'ComponentKey', { aliasName: 'alias/distribution-encryption-key' }),
// Copy the AMI to different accounts
amiTargetAccountIds: ['123456789012', '098765432109'],
// Add launch permissions on the AMI
amiLaunchPermission: {
organizationArns: [
this.formatArn({ region: '', service: 'organizations', resource: 'organization', resourceName: 'o-1234567abc' })
],
organizationalUnitArns: [
this.formatArn({
region: '',
service: 'organizations',
resource: 'ou',
resourceName: 'o-1234567abc/ou-a123-b4567890'
})
],
isPublicUserGroup: true,
accountIds: ['234567890123']
},
// Attach tags to the AMI
amiTags: {
Environment: 'production',
Version: '{{ imagebuilder:buildVersion }}'
},
// Optional - publish the distributed AMI ID to an SSM parameter
ssmParameters: [
{
parameter: ssm.StringParameter.fromStringParameterAttributes(this, 'Parameter', {
parameterName: '/imagebuilder/ami',
forceDynamicReference: true
})
},
{
amiAccount: '098765432109',
dataType: ssm.ParameterDataType.TEXT,
parameter: ssm.StringParameter.fromStringParameterAttributes(this, 'CrossAccountParameter', {
parameterName: 'imagebuilder-prod-ami',
forceDynamicReference: true
})
}
],
// Optional - create a new launch template version with the distributed AMI ID
launchTemplates: [
{
launchTemplate: ec2.LaunchTemplate.fromLaunchTemplateAttributes(this, 'LaunchTemplate', {
launchTemplateId: 'lt-1234'
}),
setDefaultVersion: true
},
{
accountId: '123456789012',
launchTemplate: ec2.LaunchTemplate.fromLaunchTemplateAttributes(this, 'CrossAccountLaunchTemplate', {
launchTemplateId: 'lt-5678'
}),
setDefaultVersion: true
}
],
// Optional - enable Fast Launch on an imported launch template
fastLaunchConfigurations: [
{
enabled: true,
launchTemplate: ec2.LaunchTemplate.fromLaunchTemplateAttributes(this, 'FastLaunchLT', {
launchTemplateName: 'fast-launch-lt'
}),
maxParallelLaunches: 10,
targetSnapshotCount: 2
}
],
// Optional - license configurations to apply to the AMI
licenseConfigurationArns: [
'arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-abcdefghijklmnopqrstuvwxyz'
]
});
Properties
| Name | Type | Description |
|---|---|---|
| ami | string | The description of the AMI. |
| ami | IKey | The KMS key to encrypt the distributed AMI with. |
| ami | Ami | The launch permissions for the AMI, defining which principals are allowed to access the AMI. |
| ami | string | The name to use for the distributed AMIs. |
| ami | { [string]: string } | The tags to apply to the distributed AMIs. |
| ami | string[] | The account IDs to copy the output AMI to. |
| fast | Fast[] | The fast launch configurations to use for enabling EC2 Fast Launch on the distributed Windows AMI. |
| launch | Launch[] | The launch templates to apply the distributed AMI to. |
| license | string[] | The License Manager license configuration ARNs to apply to the distributed AMIs. |
| region? | string | The target region to distribute AMIs to. |
| ssm | SSMParameter[] | The SSM parameters to create or update for the distributed AMIs. |
amiDescription?
Type:
string
(optional, default: None)
The description of the AMI.
amiKmsKey?
Type:
IKey
(optional, default: None)
The KMS key to encrypt the distributed AMI with.
amiLaunchPermission?
Type:
Ami
(optional, default: None)
The launch permissions for the AMI, defining which principals are allowed to access the AMI.
amiName?
Type:
string
(optional, default: A name is generated from the image recipe name)
The name to use for the distributed AMIs.
amiTags?
Type:
{ [string]: string }
(optional, default: None)
The tags to apply to the distributed AMIs.
amiTargetAccountIds?
Type:
string[]
(optional, default: None)
The account IDs to copy the output AMI to.
fastLaunchConfigurations?
Type:
Fast[]
(optional, default: None)
The fast launch configurations to use for enabling EC2 Fast Launch on the distributed Windows AMI.
launchTemplates?
Type:
Launch[]
(optional, default: None)
The launch templates to apply the distributed AMI to.
licenseConfigurationArns?
Type:
string[]
(optional, default: None)
The License Manager license configuration ARNs to apply to the distributed AMIs.
region?
Type:
string
(optional, default: The current region is used)
The target region to distribute AMIs to.
ssmParameters?
Type:
SSMParameter[]
(optional, default: None)
The SSM parameters to create or update for the distributed AMIs.

.NET
Go
Java
Python
TypeScript (