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:
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Experimental) public static final String 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:
      grant in interface IDistributionConfiguration
      Parameters:
      grantee - The principal. This parameter is required.
      actions - The list of actions. This parameter is required.
    • grantRead

      @Stability(Experimental) @NotNull public Grant grantRead(@NotNull IGrantable grantee)
      (experimental) Grant read permissions to the given grantee for the distribution configuration.

      Specified by:
      grantRead in interface IDistributionConfiguration
      Parameters:
      grantee - The principal. This parameter is required.
    • getDistributionConfigurationArn

      @Stability(Experimental) @NotNull public String getDistributionConfigurationArn()
      (experimental) The ARN of the distribution configuration.
      Specified by:
      getDistributionConfigurationArn in interface IDistributionConfiguration
    • getDistributionConfigurationName

      @Stability(Experimental) @NotNull public String getDistributionConfigurationName()
      (experimental) The name of the distribution configuration.
      Specified by:
      getDistributionConfigurationName in interface IDistributionConfiguration