AmiDistribution
- class aws_cdk.aws_imagebuilder_alpha.AmiDistribution(*, ami_description=None, ami_kms_key=None, ami_launch_permission=None, ami_name=None, ami_tags=None, ami_target_account_ids=None, fast_launch_configurations=None, launch_templates=None, license_configuration_arns=None, region=None, ssm_parameters=None)
Bases:
object(experimental) The regional distribution settings to use for an AMI build.
- Parameters:
ami_description (
Optional[str]) – (experimental) The description of the AMI. Default: Noneami_kms_key (
Optional[IKey]) – (experimental) The KMS key to encrypt the distributed AMI with. Default: Noneami_launch_permission (
Union[AmiLaunchPermission,Dict[str,Any],None]) – (experimental) The launch permissions for the AMI, defining which principals are allowed to access the AMI. Default: Noneami_name (
Optional[str]) – (experimental) The name to use for the distributed AMIs. Default: A name is generated from the image recipe nameami_tags (
Optional[Mapping[str,str]]) – (experimental) The tags to apply to the distributed AMIs. Default: Noneami_target_account_ids (
Optional[Sequence[str]]) – (experimental) The account IDs to copy the output AMI to. Default: Nonefast_launch_configurations (
Optional[Sequence[Union[FastLaunchConfiguration,Dict[str,Any]]]]) – (experimental) The fast launch configurations to use for enabling EC2 Fast Launch on the distributed Windows AMI. Default: Nonelaunch_templates (
Optional[Sequence[Union[LaunchTemplateConfiguration,Dict[str,Any]]]]) – (experimental) The launch templates to apply the distributed AMI to. Default: Nonelicense_configuration_arns (
Optional[Sequence[str]]) – (experimental) The License Manager license configuration ARNs to apply to the distributed AMIs. Default: Noneregion (
Optional[str]) – (experimental) The target region to distribute AMIs to. Default: The current region is usedssm_parameters (
Optional[Sequence[Union[SSMParameterConfigurations,Dict[str,Any]]]]) – (experimental) The SSM parameters to create or update for the distributed AMIs. Default: None
- Stability:
experimental
- ExampleMetadata:
infused
Example:
distribution_configuration = imagebuilder.DistributionConfiguration(self, "DistributionConfiguration", distribution_configuration_name="test-distribution-configuration", description="A Distribution Configuration", ami_distributions=[imagebuilder.AmiDistribution( # Distribute AMI to us-east-2 and publish the AMI ID to an SSM parameter region="us-east-2", ssm_parameters=[imagebuilder.SSMParameterConfigurations( parameter=ssm.StringParameter.from_string_parameter_attributes(self, "CrossRegionParameter", parameter_name="/imagebuilder/ami", force_dynamic_reference=True ) ) ] ) ] ) # For AMI-based image builds - add an AMI distribution in the current region distribution_configuration.add_ami_distributions( ami_name="imagebuilder-{{ imagebuilder:buildDate }}", ami_description="Build AMI", ami_kms_key=kms.Key.from_lookup(self, "ComponentKey", alias_name="alias/distribution-encryption-key"), # Copy the AMI to different accounts ami_target_account_ids=["123456789012", "098765432109"], # Add launch permissions on the AMI ami_launch_permission=imagebuilder.AmiLaunchPermission( organization_arns=[ self.format_arn(region="", service="organizations", resource="organization", resource_name="o-1234567abc") ], organizational_unit_arns=[ self.format_arn( region="", service="organizations", resource="ou", resource_name="o-1234567abc/ou-a123-b4567890" ) ], is_public_user_group=True, account_ids=["234567890123"] ), # Attach tags to the AMI ami_tags={ "Environment": "production", "Version": "{{ imagebuilder:buildVersion }}" }, # Optional - publish the distributed AMI ID to an SSM parameter ssm_parameters=[imagebuilder.SSMParameterConfigurations( parameter=ssm.StringParameter.from_string_parameter_attributes(self, "Parameter", parameter_name="/imagebuilder/ami", force_dynamic_reference=True ) ), imagebuilder.SSMParameterConfigurations( ami_account="098765432109", data_type=ssm.ParameterDataType.TEXT, parameter=ssm.StringParameter.from_string_parameter_attributes(self, "CrossAccountParameter", parameter_name="imagebuilder-prod-ami", force_dynamic_reference=True ) ) ], # Optional - create a new launch template version with the distributed AMI ID launch_templates=[imagebuilder.LaunchTemplateConfiguration( launch_template=ec2.LaunchTemplate.from_launch_template_attributes(self, "LaunchTemplate", launch_template_id="lt-1234" ), set_default_version=True ), imagebuilder.LaunchTemplateConfiguration( account_id="123456789012", launch_template=ec2.LaunchTemplate.from_launch_template_attributes(self, "CrossAccountLaunchTemplate", launch_template_id="lt-5678" ), set_default_version=True ) ], # Optional - enable Fast Launch on an imported launch template fast_launch_configurations=[imagebuilder.FastLaunchConfiguration( enabled=True, launch_template=ec2.LaunchTemplate.from_launch_template_attributes(self, "FastLaunchLT", launch_template_name="fast-launch-lt" ), max_parallel_launches=10, target_snapshot_count=2 ) ], # Optional - license configurations to apply to the AMI license_configuration_arns=["arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-abcdefghijklmnopqrstuvwxyz" ] )
Attributes
- ami_description
(experimental) The description of the AMI.
- Default:
None
- Stability:
experimental
- ami_kms_key
(experimental) The KMS key to encrypt the distributed AMI with.
- Default:
None
- Stability:
experimental
- ami_launch_permission
(experimental) The launch permissions for the AMI, defining which principals are allowed to access the AMI.
- Default:
None
- Stability:
experimental
- ami_name
(experimental) The name to use for the distributed AMIs.
- Default:
A name is generated from the image recipe name
- Stability:
experimental
- ami_tags
(experimental) The tags to apply to the distributed AMIs.
- Default:
None
- Stability:
experimental
- ami_target_account_ids
(experimental) The account IDs to copy the output AMI to.
- Default:
None
- Stability:
experimental
- fast_launch_configurations
(experimental) The fast launch configurations to use for enabling EC2 Fast Launch on the distributed Windows AMI.
- Default:
None
- See:
- Stability:
experimental
- launch_templates
(experimental) The launch templates to apply the distributed AMI to.
- Default:
None
- Stability:
experimental
- license_configuration_arns
(experimental) The License Manager license configuration ARNs to apply to the distributed AMIs.
- Default:
None
- Stability:
experimental
- region
(experimental) The target region to distribute AMIs to.
- Default:
The current region is used
- Stability:
experimental
- ssm_parameters
(experimental) The SSM parameters to create or update for the distributed AMIs.
- Default:
None
- Stability:
experimental