Class DistributionConfiguration
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.imagebuilder.alpha.DistributionConfiguration
- All Implemented Interfaces:
IEnvironmentAware,IResource,IDistributionConfiguration,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-20T23:37:34.456Z")
@Stability(Experimental)
public class DistributionConfiguration
extends Resource
implements IDistributionConfiguration
(experimental) Represents an EC2 Image Builder Distribution Configuration.
Example:
DistributionConfiguration distributionConfiguration = DistributionConfiguration.Builder.create(this, "DistributionConfiguration")
.distributionConfigurationName("test-distribution-configuration")
.description("A Distribution Configuration")
.amiDistributions(List.of(AmiDistribution.builder()
// Distribute AMI to us-east-2 and publish the AMI ID to an SSM parameter
.region("us-east-2")
.ssmParameters(List.of(SSMParameterConfigurations.builder()
.parameter(StringParameter.fromStringParameterAttributes(this, "CrossRegionParameter", StringParameterAttributes.builder()
.parameterName("/imagebuilder/ami")
.forceDynamicReference(true)
.build()))
.build()))
.build()))
.build();
// For AMI-based image builds - add an AMI distribution in the current region
distributionConfiguration.addAmiDistributions(AmiDistribution.builder()
.amiName("imagebuilder-{{ imagebuilder:buildDate }}")
.amiDescription("Build AMI")
.amiKmsKey(Key.fromLookup(this, "ComponentKey", KeyLookupOptions.builder().aliasName("alias/distribution-encryption-key").build()))
// Copy the AMI to different accounts
.amiTargetAccountIds(List.of("123456789012", "098765432109"))
// Add launch permissions on the AMI
.amiLaunchPermission(AmiLaunchPermission.builder()
.organizationArns(List.of(this.formatArn(ArnComponents.builder().region("").service("organizations").resource("organization").resourceName("o-1234567abc").build())))
.organizationalUnitArns(List.of(this.formatArn(ArnComponents.builder()
.region("")
.service("organizations")
.resource("ou")
.resourceName("o-1234567abc/ou-a123-b4567890")
.build())))
.isPublicUserGroup(true)
.accountIds(List.of("234567890123"))
.build())
// Attach tags to the AMI
.amiTags(Map.of(
"Environment", "production",
"Version", "{{ imagebuilder:buildVersion }}"))
// Optional - publish the distributed AMI ID to an SSM parameter
.ssmParameters(List.of(SSMParameterConfigurations.builder()
.parameter(StringParameter.fromStringParameterAttributes(this, "Parameter", StringParameterAttributes.builder()
.parameterName("/imagebuilder/ami")
.forceDynamicReference(true)
.build()))
.build(), SSMParameterConfigurations.builder()
.amiAccount("098765432109")
.dataType(ParameterDataType.TEXT)
.parameter(StringParameter.fromStringParameterAttributes(this, "CrossAccountParameter", StringParameterAttributes.builder()
.parameterName("imagebuilder-prod-ami")
.forceDynamicReference(true)
.build()))
.build()))
// Optional - create a new launch template version with the distributed AMI ID
.launchTemplates(List.of(LaunchTemplateConfiguration.builder()
.launchTemplate(LaunchTemplate.fromLaunchTemplateAttributes(this, "LaunchTemplate", LaunchTemplateAttributes.builder()
.launchTemplateId("lt-1234")
.build()))
.setDefaultVersion(true)
.build(), LaunchTemplateConfiguration.builder()
.accountId("123456789012")
.launchTemplate(LaunchTemplate.fromLaunchTemplateAttributes(this, "CrossAccountLaunchTemplate", LaunchTemplateAttributes.builder()
.launchTemplateId("lt-5678")
.build()))
.setDefaultVersion(true)
.build()))
// Optional - enable Fast Launch on an imported launch template
.fastLaunchConfigurations(List.of(FastLaunchConfiguration.builder()
.enabled(true)
.launchTemplate(LaunchTemplate.fromLaunchTemplateAttributes(this, "FastLaunchLT", LaunchTemplateAttributes.builder()
.launchTemplateName("fast-launch-lt")
.build()))
.maxParallelLaunches(10)
.targetSnapshotCount(2)
.build()))
// Optional - license configurations to apply to the AMI
.licenseConfigurationArns(List.of("arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-abcdefghijklmnopqrstuvwxyz"))
.build());
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class(experimental) A fluent builder forDistributionConfiguration.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.imagebuilder.alpha.IDistributionConfiguration
IDistributionConfiguration.Jsii$Default, IDistributionConfiguration.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String(experimental) Uniquely identifies this class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDistributionConfiguration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedDistributionConfiguration(software.amazon.jsii.JsiiObjectRef objRef) DistributionConfiguration(software.constructs.Construct scope, String id) DistributionConfiguration(software.constructs.Construct scope, String id, DistributionConfigurationProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAmiDistributions(AmiDistribution... amiDistributions) (experimental) Adds AMI distribution settings to the distribution configuration.voidaddContainerDistributions(ContainerDistribution... containerDistributions) (experimental) Adds container distribution settings to the distribution configuration.static IDistributionConfigurationfromDistributionConfigurationArn(software.constructs.Construct scope, String id, String distributionConfigurationArn) (experimental) Import an existing distribution configuration given its ARN.static IDistributionConfigurationfromDistributionConfigurationName(software.constructs.Construct scope, String id, String distributionConfigurationName) (experimental) Import an existing distribution configuration given its name.(experimental) The ARN of the distribution configuration.(experimental) The name of the distribution configuration.grant(IGrantable grantee, String... actions) (experimental) Grant custom actions to the given grantee for the distribution configuration.grantRead(IGrantable grantee) (experimental) Grant read permissions to the given grantee for the distribution configuration.static Boolean(experimental) Return whether the given object is a DistributionConfiguration.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
(experimental) Uniquely identifies this class.
-
-
Constructor Details
-
DistributionConfiguration
protected DistributionConfiguration(software.amazon.jsii.JsiiObjectRef objRef) -
DistributionConfiguration
protected DistributionConfiguration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
DistributionConfiguration
@Stability(Experimental) public DistributionConfiguration(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable DistributionConfigurationProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props-
-
DistributionConfiguration
@Stability(Experimental) public DistributionConfiguration(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- This parameter is required.id- This parameter is required.
-
-
Method Details
-
fromDistributionConfigurationArn
@Stability(Experimental) @NotNull public static IDistributionConfiguration fromDistributionConfigurationArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String distributionConfigurationArn) (experimental) Import an existing distribution configuration given its ARN.- Parameters:
scope- This parameter is required.id- This parameter is required.distributionConfigurationArn- This parameter is required.
-
fromDistributionConfigurationName
@Stability(Experimental) @NotNull public static IDistributionConfiguration fromDistributionConfigurationName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String distributionConfigurationName) (experimental) Import an existing distribution configuration given its name.The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
- Parameters:
scope- This parameter is required.id- This parameter is required.distributionConfigurationName- This parameter is required.
-
isDistributionConfiguration
@Stability(Experimental) @NotNull public static Boolean isDistributionConfiguration(@NotNull Object x) (experimental) Return whether the given object is a DistributionConfiguration.- Parameters:
x- This parameter is required.
-
addAmiDistributions
@Stability(Experimental) public void addAmiDistributions(@NotNull AmiDistribution... amiDistributions) (experimental) Adds AMI distribution settings to the distribution configuration.- Parameters:
amiDistributions- The list of AMI distribution settings to apply. This parameter is required.
-
addContainerDistributions
@Stability(Experimental) public void addContainerDistributions(@NotNull ContainerDistribution... containerDistributions) (experimental) Adds container distribution settings to the distribution configuration.- Parameters:
containerDistributions- The list of container distribution settings to apply. This parameter is required.
-
grant
@Stability(Experimental) @NotNull public Grant grant(@NotNull IGrantable grantee, @NotNull String... actions) (experimental) Grant custom actions to the given grantee for the distribution configuration.- Specified by:
grantin interfaceIDistributionConfiguration- Parameters:
grantee- The principal. This parameter is required.actions- The list of actions. This parameter is required.
-
grantRead
(experimental) Grant read permissions to the given grantee for the distribution configuration.- Specified by:
grantReadin interfaceIDistributionConfiguration- Parameters:
grantee- The principal. This parameter is required.
-
getDistributionConfigurationArn
(experimental) The ARN of the distribution configuration.- Specified by:
getDistributionConfigurationArnin interfaceIDistributionConfiguration
-
getDistributionConfigurationName
(experimental) The name of the distribution configuration.- Specified by:
getDistributionConfigurationNamein interfaceIDistributionConfiguration
-