View a markdown version of this page

AWS::ImageBuilder::DistributionConfiguration Distribution - AWS CloudFormation

This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.

AWS::ImageBuilder::DistributionConfiguration Distribution

Defines the settings for a specific Region in the distribution configuration. You must specify whether the distribution is for an AMI or a container image. To do so, include exactly one of the following data types for your distribution:

  • AmiDistributionConfiguration

  • ContainerDistributionConfiguration

Syntax

To declare this entity in your CloudFormation template, use the following syntax:

Properties

AmiDistributionConfiguration

The specific AMI settings; for example, launch permissions or AMI tags.

Required: No

Type: AmiDistributionConfiguration

Update requires: No interruption

ContainerDistributionConfiguration

Container distribution settings for encryption, licensing, and sharing in a specific Region.

Required: No

Type: ContainerDistributionConfiguration

Update requires: No interruption

FastLaunchConfigurations

The Windows faster-launching configurations to use for AMI distribution.

Required: No

Type: Array of FastLaunchConfiguration

Minimum: 1

Maximum: 1000

Update requires: No interruption

LaunchTemplateConfigurations

A group of launchTemplateConfiguration settings that apply to image distribution for specified accounts.

Required: No

Type: Array of LaunchTemplateConfiguration

Minimum: 1

Maximum: 100

Update requires: No interruption

LicenseConfigurationArns

The License Manager Configuration to associate with the AMI in the specified Region.

Required: No

Type: Array of String

Minimum: 1

Maximum: 50

Update requires: No interruption

Region

The target Region.

Required: Yes

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

SsmParameterConfigurations

Contains settings to update AWS Systems Manager (SSM) Parameter Store Parameters with output AMI IDs from the build by target Region.

Required: No

Type: Array of SsmParameterConfiguration

Update requires: No interruption

Examples

Example 1: AmiDistributionConfiguration with launch permissions

The following example shows the template for the AmiDistributionConfiguration property in both YAML and JSON format.

Note

To make an AMI public, set the launch permission authorized accounts to all. See the examples for making an AMI public at EC2 ModifyImageAttribute.

YAML

Distributions: - Region: 'us-west-2' AmiDistributionConfiguration: Name: 'AmiCopyConfiguration - {{ imagebuilder:buildDate }}' Description: 'Share an AMI in the distribution Region by granting launch permissions to specified organizations, OUs, user groups, and accounts.' AmiTags: AmiTagKey: 'AmiTagValue' LaunchPermissionConfiguration: OrganizationArns: - 'arn:aws:organizations::123456789012:organization/o-myorganization123' OrganizationalUnitArns: - 'arn:aws:organizations::123456789012:ou/o-123example/ou-1234-myorganizationalunit' UserGroups: - 'GroupName1' - 'GroupName2' UserIds: - '123456789012' - '345678901234'

JSON

{ "Distributions": [{ "Region": "us-west-2", "AmiDistributionConfiguration": { "Name": "AmiCopyConfiguration - {{ imagebuilder:buildDate }}", "Description": "Share an AMI in the distribution Region by granting launch permissions to specified organizations, OUs, user groups, and accounts.", "AmiTags": { "AmiTagKey": "AmiTagValue" }, "LaunchPermissionConfiguration": { "OrganizationArns": [ "arn:aws:organizations::123456789012:organization/o-myorganization123" ], "OrganizationalUnitArns": [ "arn:aws:organizations::123456789012:ou/o-123example/ou-1234-myorganizationalunit" ], "UserGroups": [ "GroupName1", "GroupName2" ], "UserIds": [ "123456789012", "345678901234" ] } } }] }

Example 2: Create a distribution configuration resource for a copied AMI

The following example shows the template for the AmiDistributionConfiguration property in both YAML and JSON.

YAML

Distributions: - Region: 'us-west-2' AmiDistributionConfiguration: Name: AmiCopyConfiguration - {{ imagebuilder:buildDate }} Description: 'Distribute a copy of the AMI to specific accounts in the destination Region.' AmiTags: AmiTagKey: 'AmiTagValue' TargetAccountIds: - '123456789012' - '345678901234'

JSON

{ "Distributions": [{ "Region": "us-west-2", "AmiDistributionConfiguration": { "Name": "AmiCopyConfiguration - {{ imagebuilder:buildDate }}", "Description": "Distribute a copy of the AMI to specific accounts in the destination Region.", "AmiTags": { "AmiTagKey": "AmiTagValue" }, "TargetAccountIds": ["123456789012", "345678901234"] } }] }

Example 3: ContainerDistributionConfiguration

The following example shows the template for the ContainerDistributionConfiguration property in both YAML and JSON format.

YAML

Distributions: - Region: 'us-west-2' ContainerDistributionConfiguration: Description: 'Container distribution for us-west-2' TargetRepository: Service: ECR RepositoryName: 'cfn-test' ContainerTags: - 'Tag1' - 'Tag2'

JSON

{ "Distributions": [{ "Region": "us-west-2", "ContainerDistributionConfiguration": { "Description": "Container distribution for us-west-2", "TargetRepository": { "Service": "ECR", "RepositoryName": "cfn-test" }, "ContainerTags": ["Tag1", "Tag2"] } }] }