class ContainerInstanceImage
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.ContainerInstanceImage |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#ContainerInstanceImage |
Java | software.amazon.awscdk.services.imagebuilder.alpha.ContainerInstanceImage |
Python | aws_cdk.aws_imagebuilder_alpha.ContainerInstanceImage |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป ContainerInstanceImage |
Represents a container instance image that is used to launch the instance used for building the container for an EC2 Image Builder container build.
Example
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'InstanceConfigContainerRecipe', {
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
targetRepository: imagebuilder.Repository.fromEcr(
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
),
// Custom ECS-optimized AMI for building
instanceImage: imagebuilder.ContainerInstanceImage.fromSsmParameterName(
'/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id'
),
// Additional storage for build process
instanceBlockDevices: [
{
deviceName: '/dev/xvda',
volume: ec2.BlockDeviceVolume.ebs(50, {
encrypted: true,
volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3
})
}
]
});
Initializer (protected)
super(image: string)
Parameters
- image
string
Properties
| Name | Type | Description |
|---|---|---|
| image | string | The rendered container instance image to use. |
image
Type:
string
The rendered container instance image to use.
Methods
| Name | Description |
|---|---|
| static from | The AMI ID to use to launch the instance for building the container image. |
| static from | The SSM parameter to use to launch the instance for building the container image. |
| static from | The ARN of the SSM parameter used to launch the instance for building the container image. |
| static from | The string value of the container instance image to use in a container recipe. |
static fromAmiId(amiId)
public static fromAmiId(amiId: string): ContainerInstanceImage
Parameters
- amiId
stringโ The AMI ID to use as the container instance image.
Returns
The AMI ID to use to launch the instance for building the container image.
static fromSsmParameter(parameter)
public static fromSsmParameter(parameter: IStringParameter): ContainerInstanceImage
Parameters
- parameter
IStringโ The SSM parameter to use as the container instance image.Parameter
Returns
The SSM parameter to use to launch the instance for building the container image.
static fromSsmParameterName(parameterName)
public static fromSsmParameterName(parameterName: string): ContainerInstanceImage
Parameters
- parameterName
stringโ The name of the SSM parameter used as the container instance image.
Returns
The ARN of the SSM parameter used to launch the instance for building the container image.
static fromString(containerInstanceImageString)
public static fromString(containerInstanceImageString: string): ContainerInstanceImage
Parameters
- containerInstanceImageString
stringโ The container instance image as a direct string value.
Returns
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

.NET
Go
Java
Python
TypeScript (