Interface AmiDistribution

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AmiDistribution.Jsii$Proxy

@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)", date="2025-11-20T23:37:34.433Z") @Stability(Experimental) public interface AmiDistribution extends software.amazon.jsii.JsiiSerializable
(experimental) The regional distribution settings to use for an AMI build.

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());
 
  • Method Details

    • getAmiDescription

      @Stability(Experimental) @Nullable default String getAmiDescription()
      (experimental) The description of the AMI.

      Default: None

    • getAmiKmsKey

      @Stability(Experimental) @Nullable default IKey getAmiKmsKey()
      (experimental) The KMS key to encrypt the distributed AMI with.

      Default: None

    • getAmiLaunchPermission

      @Stability(Experimental) @Nullable default AmiLaunchPermission getAmiLaunchPermission()
      (experimental) The launch permissions for the AMI, defining which principals are allowed to access the AMI.

      Default: None

    • getAmiName

      @Stability(Experimental) @Nullable default String getAmiName()
      (experimental) The name to use for the distributed AMIs.

      Default: A name is generated from the image recipe name

    • getAmiTags

      @Stability(Experimental) @Nullable default Map<String,String> getAmiTags()
      (experimental) The tags to apply to the distributed AMIs.

      Default: None

    • getAmiTargetAccountIds

      @Stability(Experimental) @Nullable default List<String> getAmiTargetAccountIds()
      (experimental) The account IDs to copy the output AMI to.

      Default: None

    • getFastLaunchConfigurations

      @Stability(Experimental) @Nullable default List<FastLaunchConfiguration> getFastLaunchConfigurations()
      (experimental) The fast launch configurations to use for enabling EC2 Fast Launch on the distributed Windows AMI.

      Default: None

      See Also:
    • getLaunchTemplates

      @Stability(Experimental) @Nullable default List<LaunchTemplateConfiguration> getLaunchTemplates()
      (experimental) The launch templates to apply the distributed AMI to.

      Default: None

    • getLicenseConfigurationArns

      @Stability(Experimental) @Nullable default List<String> getLicenseConfigurationArns()
      (experimental) The License Manager license configuration ARNs to apply to the distributed AMIs.

      Default: None

    • getRegion

      @Stability(Experimental) @Nullable default String getRegion()
      (experimental) The target region to distribute AMIs to.

      Default: The current region is used

    • getSsmParameters

      @Stability(Experimental) @Nullable default List<SSMParameterConfigurations> getSsmParameters()
      (experimental) The SSM parameters to create or update for the distributed AMIs.

      Default: None

    • builder

      @Stability(Experimental) static AmiDistribution.Builder builder()
      Returns:
      a AmiDistribution.Builder of AmiDistribution