ContainerInstanceImage

class aws_cdk.aws_imagebuilder_alpha.ContainerInstanceImage(image)

Bases: object

(experimental) Represents a container instance image that is used to launch the instance used for building the container for an EC2 Image Builder container build.

Stability:

experimental

ExampleMetadata:

infused

Example:

container_recipe = imagebuilder.ContainerRecipe(self, "InstanceConfigContainerRecipe",
    base_image=imagebuilder.BaseContainerImage.from_docker_hub("amazonlinux", "latest"),
    target_repository=imagebuilder.Repository.from_ecr(
        ecr.Repository.from_repository_name(self, "Repository", "my-container-repo")),
    # Custom ECS-optimized AMI for building
    instance_image=imagebuilder.ContainerInstanceImage.from_ssm_parameter_name("/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id"),
    # Additional storage for build process
    instance_block_devices=[ec2.BlockDevice(
        device_name="/dev/xvda",
        volume=ec2.BlockDeviceVolume.ebs(50,
            encrypted=True,
            volume_type=ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3
        )
    )
    ]
)
Parameters:

image (str)

Stability:

experimental

Attributes

image

(experimental) The rendered container instance image to use.

Stability:

experimental

Static Methods

classmethod from_ami_id(ami_id)

(experimental) The AMI ID to use to launch the instance for building the container image.

Parameters:

ami_id (str) – The AMI ID to use as the container instance image.

Stability:

experimental

Return type:

ContainerInstanceImage

classmethod from_ssm_parameter(parameter)

(experimental) The SSM parameter to use to launch the instance for building the container image.

Parameters:

parameter (IStringParameter) – The SSM parameter to use as the container instance image.

Stability:

experimental

Return type:

ContainerInstanceImage

classmethod from_ssm_parameter_name(parameter_name)

(experimental) The ARN of the SSM parameter used to launch the instance for building the container image.

Parameters:

parameter_name (str) – The name of the SSM parameter used as the container instance image.

Stability:

experimental

Return type:

ContainerInstanceImage

classmethod from_string(container_instance_image_string)

(experimental) The string value of the container instance image to use in a container recipe.

This can either be:

  • an SSM parameter reference, prefixed with ssm: and followed by the parameter name or ARN

  • an AMI ID

Parameters:

container_instance_image_string (str) – The container instance image as a direct string value.

Stability:

experimental

Return type:

ContainerInstanceImage