Experimental
@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ContainerRecipe L2 construct
Represents an EC2 Image Builder Container Recipe.
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
});
container_recipe = imagebuilder.ContainerRecipe(self, "MyContainerRecipe",
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"))
)
container_pipeline = imagebuilder.ImagePipeline(self, "MyContainerPipeline",
recipe=example_container_recipe
)
ContainerRecipe containerRecipe = ContainerRecipe.Builder.create(this, "MyContainerRecipe")
.baseImage(BaseContainerImage.fromDockerHub("amazonlinux", "latest"))
.targetRepository(Repository.fromEcr(Repository.fromRepositoryName(this, "Repository", "my-container-repo")))
.build();
ImagePipeline containerPipeline = ImagePipeline.Builder.create(this, "MyContainerPipeline")
.recipe(exampleContainerRecipe)
.build();
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var containerRecipe = new ContainerRecipe(this, "MyContainerRecipe", new ContainerRecipeProps {
BaseImage = BaseContainerImage.FromDockerHub("amazonlinux", "latest"),
TargetRepository = Repository.FromEcr(Repository.FromRepositoryName(this, "Repository", "my-container-repo"))
});
var containerPipeline = new ImagePipeline(this, "MyContainerPipeline", new ImagePipelineProps {
Recipe = exampleContainerRecipe
});
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
containerRecipe := imagebuilder.NewContainerRecipe(this, jsii.String("MyContainerRecipe"), &ContainerRecipeProps{
BaseImage: imagebuilder.BaseContainerImage_*FromDockerHub(jsii.String("amazonlinux"), jsii.String("latest")),
TargetRepository: imagebuilder.Repository_*FromEcr(ecr.Repository_*FromRepositoryName(this, jsii.String("Repository"), jsii.String("my-container-repo"))),
})
containerPipeline := imagebuilder.NewImagePipeline(this, jsii.String("MyContainerPipeline"), &ImagePipelineProps{
Recipe: exampleContainerRecipe,
})
Initializer
new ContainerRecipe(scope: Construct, id: string, props: ContainerRecipeProps)
ContainerRecipe(scope: Construct, id: str, props: ContainerRecipeProps)
new ContainerRecipe(Construct scope, String id, ContainerRecipeProps props)
new ContainerRecipe(Construct scope, string id, ContainerRecipeProps props)
NewContainerRecipe(Scope Construct, Id *string, Props ContainerRecipeProps)
Construct Props
baseImageBaseContainerImagebase_imageBaseContainerImagebaseImageBaseContainerImageBaseImageBaseContainerImageBaseImageBaseContainerImagerequired#componentsComponentConfiguration[]componentstyping.List[ComponentConfiguration]componentsList<ComponentConfiguration>ComponentsComponentConfiguration[]Components*[]ComponentConfiguration= None#containerRecipeNamestringcontainer_recipe_namestrcontainerRecipeNameStringContainerRecipeNamestringContainerRecipeName*string#Default: a name is generated
containerRecipeVersionstringcontainer_recipe_versionstrcontainerRecipeVersionStringContainerRecipeVersionstringContainerRecipeVersion*string= 1.0.x#dockerfileDockerfileDatadockerfileDockerfileDatadockerfileDockerfileDataDockerfileDockerfileDataDockerfileDockerfileData#Default: a standard dockerfile template will be generated to pull the base image, perform environment setup, and run all components in the recipe
instanceBlockDevicesBlockDevice[]instance_block_devicestyping.List[BlockDevice]instanceBlockDevicesList<BlockDevice>InstanceBlockDevicesBlockDevice[]InstanceBlockDevices*[]BlockDevice#Default: the block devices of the instance image will be used
instanceImageContainerInstanceImageinstance_imageContainerInstanceImageinstanceImageContainerInstanceImageInstanceImageContainerInstanceImageInstanceImageContainerInstanceImage#Default: Image Builder will use the appropriate ECS-optimized AMI
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.
tags{ [key: string]: string }tagstyping.Mapping[str, str]tagsMap<String, String>TagsIDictionary<string, string>Tags*map[string]*string= None#targetRepositoryRepositorytarget_repositoryRepositorytargetRepositoryRepositoryTargetRepositoryRepositoryTargetRepositoryRepositoryrequired#workingDirectorystringworking_directorystrworkingDirectoryStringWorkingDirectorystringWorkingDirectory*string#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:/
Properties
containerRecipeArnstringcontainer_recipe_arnstrcontainerRecipeArnStringContainerRecipeArnstringContainerRecipeArn*stringrequired#containerRecipeNamestringcontainer_recipe_namestrcontainerRecipeNameStringContainerRecipeNamestringContainerRecipeName*stringrequired#containerRecipeVersionstringcontainer_recipe_versionstrcontainerRecipeVersionStringContainerRecipeVersionstringContainerRecipeVersion*stringrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
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.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#Methods
addInstanceBlockDevice(...instanceBlockDevices: BlockDevice[]): voiddef add_instance_block_device(self, instance_block_devices: BlockDevice) -> Nonepublic void addInstanceBlockDevice(BlockDevice instanceBlockDevices)public void AddInstanceBlockDevice(BlockDevice instanceBlockDevices)func AddInstanceBlockDevice(InstanceBlockDevices BlockDevice)#1 parameter
Parameters
instanceBlockDevicesinstance_block_devicesinstanceBlockDevicesinstanceBlockDevicesInstanceBlockDevices— - The list of block devices to attach.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
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).
fromContainerRecipeArn(scope: Construct, id: string, containerRecipeArn: string): IContainerRecipe@staticmethod def from_container_recipe_arn(scope: Construct, id: str, container_recipe_arn: str) -> IContainerRecipepublic static IContainerRecipe fromContainerRecipeArn(Construct scope, String id, String containerRecipeArn)public static IContainerRecipe FromContainerRecipeArn(Construct scope, string id, string containerRecipeArn)func FromContainerRecipeArn(Scope Construct, Id *string, ContainerRecipeArn *string) IContainerRecipestatic#fromContainerRecipeAttributes(scope: Construct, id: string, attrs: ContainerRecipeAttributes): IContainerRecipe@staticmethod def from_container_recipe_attributes(scope: Construct, id: str, attrs: ContainerRecipeAttributes) -> IContainerRecipepublic static IContainerRecipe fromContainerRecipeAttributes(Construct scope, String id, ContainerRecipeAttributes attrs)public static IContainerRecipe FromContainerRecipeAttributes(Construct scope, string id, ContainerRecipeAttributes attrs)func FromContainerRecipeAttributes(Scope Construct, Id *string, Attrs ContainerRecipeAttributes) IContainerRecipestatic#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.
fromContainerRecipeName(scope: Construct, id: string, containerRecipeName: string): IContainerRecipe@staticmethod def from_container_recipe_name(scope: Construct, id: str, container_recipe_name: str) -> IContainerRecipepublic static IContainerRecipe fromContainerRecipeName(Construct scope, String id, String containerRecipeName)public static IContainerRecipe FromContainerRecipeName(Construct scope, string id, string containerRecipeName)func FromContainerRecipeName(Scope Construct, Id *string, ContainerRecipeName *string) IContainerRecipestatic#The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#2 parameters
Parameters
granteegranteegranteegranteeGrantee— The principal.actionsactionsactionsactionsActions— The list of actions.
grantRead(grantee: IGrantable): Grantdef grant_read(self, grantee: IGrantable) -> Grantpublic Grant grantRead(IGrantable grantee)public Grant GrantRead(IGrantable grantee)func GrantRead(Grantee IGrantable) Grant#1 parameter
Parameters
granteegranteegranteegranteeGrantee— The principal.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isContainerRecipe(x: any): boolean@staticmethod def is_container_recipe(x: Any) -> boolpublic static Boolean isContainerRecipe(Object x)public static bool IsContainerRecipe(object x)func IsContainerRecipe(X interface{}) *boolstatic#isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.