class ContainerRecipe (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.ContainerRecipe |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#ContainerRecipe |
Java | software.amazon.awscdk.services.imagebuilder.alpha.ContainerRecipe |
Python | aws_cdk.aws_imagebuilder_alpha.ContainerRecipe |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป ContainerRecipe |
Implements
IConstruct, IDependable, IResource, IEnvironment, IContainer, IRecipe
Represents an EC2 Image Builder Container Recipe.
See also: https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-recipes.html
Example
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'MyContainerRecipe', {
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
targetRepository: imagebuilder.Repository.fromEcr(
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
)
});
const containerPipeline = new imagebuilder.ImagePipeline(this, 'MyContainerPipeline', {
recipe: exampleContainerRecipe
});
Initializer
new ContainerRecipe(scope: Construct, id: string, props: ContainerRecipeProps)
Parameters
- scope
Construct - id
string - props
ContainerRecipe Props
Construct Props
| Name | Type | Description |
|---|---|---|
| base | Base | The base image for customizations specified in the container recipe. |
| target | Repository | The container repository where the output container image is stored. |
| components? | Component[] | The list of component configurations to apply in the image build. |
| container | string | The name of the container recipe. |
| container | string | The version of the container recipe. |
| description? | string | The description of the container recipe. |
| dockerfile? | Dockerfile | The dockerfile template used to build the container image. |
| instance | Block[] | The block devices to attach to the instance used for building, testing, and distributing the container image. |
| instance | Container | The image to use to launch the instance used for building, testing, and distributing the container image. |
| kms | IKey | The KMS key used to encrypt the dockerfile template. |
| os | OSVersion | The operating system (OS) version of the base image. |
| tags? | { [string]: string } | The tags to apply to the container recipe. |
| working | string | The working directory for use during build and test workflows. |
baseImage
Type:
Base
The base image for customizations specified in the container recipe.
targetRepository
Type:
Repository
The container repository where the output container image is stored.
components?
Type:
Component[]
(optional, default: None)
The list of component configurations to apply in the image build.
containerRecipeName?
Type:
string
(optional, default: a name is generated)
The name of the container recipe.
containerRecipeVersion?
Type:
string
(optional, default: 1.0.x)
The version of the container recipe.
description?
Type:
string
(optional, default: None)
The description of the container recipe.
dockerfile?
Type:
Dockerfile
(optional, default: a standard dockerfile template will be generated to pull the base image, perform environment setup, and
run all components in the recipe)
The dockerfile template used to build the container image.
instanceBlockDevices?
Type:
Block[]
(optional, default: the block devices of the instance image will be used)
The block devices to attach to the instance used for building, testing, and distributing the container image.
instanceImage?
Type:
Container
(optional, default: Image Builder will use the appropriate ECS-optimized AMI)
The image to use to launch the instance used for building, testing, and distributing the container image.
kmsKey?
Type:
IKey
(optional, default: None)
The KMS key used to encrypt the dockerfile template.
osVersion?
Type:
OSVersion
(optional, default: Image Builder will determine the OS version of the base image, if sourced from a third-party container
registry. Otherwise, the OS version of the base image is required.)
The operating system (OS) version of the base image.
tags?
Type:
{ [string]: string }
(optional, default: None)
The tags to apply to the container recipe.
workingDirectory?
Type:
string
(optional, default: the Image Builder default working directory is used. For Linux and macOS builds, this would be /tmp. For
Windows builds, this would be C:/)
The working directory for use during build and test workflows.
Properties
| Name | Type | Description |
|---|---|---|
| container | string | The ARN of the container recipe. |
| container | string | The name of the container recipe. |
| container | string | The version of the container recipe. |
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
containerRecipeArn
Type:
string
The ARN of the container recipe.
containerRecipeName
Type:
string
The name of the container recipe.
containerRecipeVersion
Type:
string
The version of the container recipe.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| add | Adds block devices to attach to the instance used for building, testing, and distributing the container image. |
| apply | Apply the given removal policy to this resource. |
| grant(grantee, ...actions) | Grant custom actions to the given grantee for the container recipe. |
| grant | Grant read permissions to the given grantee for the container recipe. |
| to | Returns a string representation of this construct. |
| static from | Import an existing container recipe given its ARN. |
| static from | Import an existing container recipe by providing its attributes. |
| static from | Import the latest version of an existing container recipe given its name. |
| static is | Return whether the given object is a ContainerRecipe. |
addInstanceBlockDevice(...instanceBlockDevices)
public addInstanceBlockDevice(...instanceBlockDevices: BlockDevice[]): void
Parameters
- instanceBlockDevices
Blockโ - The list of block devices to attach.Device
Adds block devices to attach to the instance used for building, testing, and distributing the container image.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantableโ The principal. - actions
stringโ The list of actions.
Returns
Grant custom actions to the given grantee for the container recipe.
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ The principal.
Returns
Grant read permissions to the given grantee for the container recipe.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromContainerRecipeArn(scope, id, containerRecipeArn)
public static fromContainerRecipeArn(scope: Construct, id: string, containerRecipeArn: string): IContainerRecipe
Parameters
- scope
Construct - id
string - containerRecipeArn
string
Returns
Import an existing container recipe given its ARN.
static fromContainerRecipeAttributes(scope, id, attrs)
public static fromContainerRecipeAttributes(scope: Construct, id: string, attrs: ContainerRecipeAttributes): IContainerRecipe
Parameters
- scope
Construct - id
string - attrs
ContainerRecipe Attributes
Returns
Import an existing container recipe by providing its attributes.
If the container recipe name is provided as an attribute, it must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
static fromContainerRecipeName(scope, id, containerRecipeName)
public static fromContainerRecipeName(scope: Construct, id: string, containerRecipeName: string): IContainerRecipe
Parameters
- scope
Construct - id
string - containerRecipeName
string
Returns
Import the latest version of an existing container recipe given its name.
The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
static isContainerRecipe(x)
public static isContainerRecipe(x: any): boolean
Parameters
- x
any
Returns
boolean
Return whether the given object is a ContainerRecipe.

.NET
Go
Java
Python
TypeScript (