> **Experimental**
>
> `@aws-cdk/aws-imagebuilder-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# AmiDistribution

The regional distribution settings to use for an AMI build.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/distribution-configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-imagebuilder-alpha/lib/distribution-configuration.ts#L189)

## Example

TypeScript:

```ts
const infrastructureConfiguration = new imagebuilder.InfrastructureConfiguration(this, 'Infrastructure', {
  infrastructureConfigurationName: 'production-infrastructure',
  instanceTypes: [
    ec2.InstanceType.of(ec2.InstanceClass.COMPUTE7_INTEL, ec2.InstanceSize.LARGE)
  ],
  vpc: vpc,
  subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }
});

const distributionConfiguration = new imagebuilder.DistributionConfiguration(this, 'Distribution');
distributionConfiguration.addAmiDistributions({
  amiName: 'production-ami-{{ imagebuilder:buildDate }}',
  amiTargetAccountIds: ['123456789012', '098765432109']
});

const productionPipeline = new imagebuilder.ImagePipeline(this, 'ProductionPipeline', {
  recipe: exampleImageRecipe,
  infrastructureConfiguration: infrastructureConfiguration,
  distributionConfiguration: distributionConfiguration
});
```

Python:

```python
infrastructure_configuration = imagebuilder.InfrastructureConfiguration(self, "Infrastructure",
    infrastructure_configuration_name="production-infrastructure",
    instance_types=[
        ec2.InstanceType.of(ec2.InstanceClass.COMPUTE7_INTEL, ec2.InstanceSize.LARGE)
    ],
    vpc=vpc,
    subnet_selection=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS)
)

distribution_configuration = imagebuilder.DistributionConfiguration(self, "Distribution")
distribution_configuration.add_ami_distributions(
    ami_name="production-ami-{{ imagebuilder:buildDate }}",
    ami_target_account_ids=["123456789012", "098765432109"]
)

production_pipeline = imagebuilder.ImagePipeline(self, "ProductionPipeline",
    recipe=example_image_recipe,
    infrastructure_configuration=infrastructure_configuration,
    distribution_configuration=distribution_configuration
)
```

Java:

```java
InfrastructureConfiguration infrastructureConfiguration = InfrastructureConfiguration.Builder.create(this, "Infrastructure")
        .infrastructureConfigurationName("production-infrastructure")
        .instanceTypes(List.of(InstanceType.of(InstanceClass.COMPUTE7_INTEL, InstanceSize.LARGE)))
        .vpc(vpc)
        .subnetSelection(SubnetSelection.builder().subnetType(SubnetType.PRIVATE_WITH_EGRESS).build())
        .build();

DistributionConfiguration distributionConfiguration = new DistributionConfiguration(this, "Distribution");
distributionConfiguration.addAmiDistributions(AmiDistribution.builder()
        .amiName("production-ami-{{ imagebuilder:buildDate }}")
        .amiTargetAccountIds(List.of("123456789012", "098765432109"))
        .build());

ImagePipeline productionPipeline = ImagePipeline.Builder.create(this, "ProductionPipeline")
        .recipe(exampleImageRecipe)
        .infrastructureConfiguration(infrastructureConfiguration)
        .distributionConfiguration(distributionConfiguration)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var infrastructureConfiguration = new InfrastructureConfiguration(this, "Infrastructure", new InfrastructureConfigurationProps {
    InfrastructureConfigurationName = "production-infrastructure",
    InstanceTypes = new [] { InstanceType.Of(InstanceClass.COMPUTE7_INTEL, InstanceSize.LARGE) },
    Vpc = vpc,
    SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS }
});

var distributionConfiguration = new DistributionConfiguration(this, "Distribution");
distributionConfiguration.AddAmiDistributions(new AmiDistribution {
    AmiName = "production-ami-{{ imagebuilder:buildDate }}",
    AmiTargetAccountIds = new [] { "123456789012", "098765432109" }
});

var productionPipeline = new ImagePipeline(this, "ProductionPipeline", new ImagePipelineProps {
    Recipe = exampleImageRecipe,
    InfrastructureConfiguration = infrastructureConfiguration,
    DistributionConfiguration = distributionConfiguration
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
infrastructureConfiguration := imagebuilder.NewInfrastructureConfiguration(this, jsii.String("Infrastructure"), &InfrastructureConfigurationProps{
	InfrastructureConfigurationName: jsii.String("production-infrastructure"),
	InstanceTypes: []InstanceType{
		ec2.InstanceType_*Of(ec2.InstanceClass_COMPUTE7_INTEL, ec2.InstanceSize_LARGE),
	},
	Vpc: vpc,
	SubnetSelection: &SubnetSelection{
		SubnetType: ec2.SubnetType_PRIVATE_WITH_EGRESS,
	},
})

distributionConfiguration := imagebuilder.NewDistributionConfiguration(this, jsii.String("Distribution"))
distributionConfiguration.AddAmiDistributions(&AmiDistribution{
	AmiName: jsii.String("production-ami-{{ imagebuilder:buildDate }}"),
	AmiTargetAccountIds: []*string{
		jsii.String("123456789012"),
		jsii.String("098765432109"),
	},
})

productionPipeline := imagebuilder.NewImagePipeline(this, jsii.String("ProductionPipeline"), &ImagePipelineProps{
	Recipe: exampleImageRecipe,
	InfrastructureConfiguration: infrastructureConfiguration,
	DistributionConfiguration: distributionConfiguration,
})
```

## Properties

- `amiDescription`: string = None — The description of the AMI.

- `amiKmsKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) = None — The KMS key to encrypt the distributed AMI with.

- `amiLaunchPermission`: [AmiLaunchPermission](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.AmiLaunchPermission.html) = None — The launch permissions for the AMI, defining which principals are allowed to access the AMI.

- `amiName`: string — The name to use for the distributed AMIs.

  **Default:** A name is generated from the image recipe name

- `amiTags`: { [key: string]: string } = None — The tags to apply to the distributed AMIs.

- `amiTargetAccountIds`: string[] = None — The account IDs to copy the output AMI to.

- `fastLaunchConfigurations`: [FastLaunchConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.FastLaunchConfiguration.html)[] = None — The fast launch configurations to use for enabling EC2 Fast Launch on the distributed Windows AMI.

- `launchTemplates`: [LaunchTemplateConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.LaunchTemplateConfiguration.html)[] = None — The launch templates to apply the distributed AMI to.

- `licenseConfigurationArns`: string[] = None — The License Manager license configuration ARNs to apply to the distributed AMIs.

- `region`: string — The target region to distribute AMIs to.

  **Default:** The current region is used

- `ssmParameters`: [SSMParameterConfigurations](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.SSMParameterConfigurations.html)[] = None — The SSM parameters to create or update for the distributed AMIs.
