createDistributionConfiguration
inline suspend fun ImagebuilderClient.createDistributionConfiguration(crossinline block: CreateDistributionConfigurationRequest.Builder.() -> Unit): CreateDistributionConfigurationResponse
Creates a new distribution configuration. Distribution configurations define and configure the outputs for your images, including the target Regions, accounts, and settings for each Region.
Samples
// The following example creates a distribution configuration that distributes the output AMI to two
// Regions. The AMI name includes the build date, so that repeated builds create unique AMI names.
val resp = imagebuilderClient.createDistributionConfiguration {
name = "my-example-distribution"
description = "Copies the output AMI to a second Region"
distributions = listOf<Distribution>(
Distribution {
region = "us-west-2"
amiDistributionConfiguration = AmiDistributionConfiguration {
name = "my-example-image-{{ imagebuilder:buildDate }}"
}
},
Distribution {
region = "us-east-1"
amiDistributionConfiguration = AmiDistributionConfiguration {
name = "my-example-image-{{ imagebuilder:buildDate }}"
}
}
)
clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE44444"
}Content copied to clipboard
// The following example creates a distribution configuration that distributes the output AMI to two
// Regions. In us east 1, it shares the AMI with another AWS account. In us west 2, it sets the new AMI as the
// default version of your launch template.
val resp = imagebuilderClient.createDistributionConfiguration {
name = "my-example-distribution"
description = "Distributes the output AMI to two Regions and shares it with another account"
distributions = listOf<Distribution>(
Distribution {
region = "us-west-2"
amiDistributionConfiguration = AmiDistributionConfiguration {
name = "my-example-image-{{ imagebuilder:buildDate }}"
}
launchTemplateConfigurations = listOf<LaunchTemplateConfiguration>(
LaunchTemplateConfiguration {
launchTemplateId = "lt-1234567890abcdef0"
setDefaultVersion = true
}
)
},
Distribution {
region = "us-east-1"
amiDistributionConfiguration = AmiDistributionConfiguration {
name = "my-example-image-{{ imagebuilder:buildDate }}"
launchPermission = LaunchPermissionConfiguration {
userIds = listOf<String>(
"444455556666"
)
}
}
}
)
clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE56789"
}Content copied to clipboard