ContainerRecipe
- class aws_cdk.aws_imagebuilder_alpha.ContainerRecipe(scope, id, *, base_image, target_repository, components=None, container_recipe_name=None, container_recipe_version=None, description=None, dockerfile=None, instance_block_devices=None, instance_image=None, kms_key=None, os_version=None, tags=None, working_directory=None)
Bases:
ContainerRecipeBase(experimental) Represents an EC2 Image Builder Container Recipe.
- See:
https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-recipes.html
- Stability:
experimental
- ExampleMetadata:
infused
Example:
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 )
- Parameters:
scope (
Construct)id (
str)base_image (
BaseContainerImage) – (experimental) The base image for customizations specified in the container recipe.target_repository (
Repository) – (experimental) The container repository where the output container image is stored.components (
Optional[Sequence[Union[ComponentConfiguration,Dict[str,Any]]]]) – (experimental) The list of component configurations to apply in the image build. Default: Nonecontainer_recipe_name (
Optional[str]) – (experimental) The name of the container recipe. Default: a name is generatedcontainer_recipe_version (
Optional[str]) – (experimental) The version of the container recipe. Default: 1.0.xdescription (
Optional[str]) – (experimental) The description of the container recipe. Default: Nonedockerfile (
Optional[DockerfileData]) – (experimental) The dockerfile template used to build the container image. Default: - a standard dockerfile template will be generated to pull the base image, perform environment setup, and run all components in the recipeinstance_block_devices (
Optional[Sequence[Union[BlockDevice,Dict[str,Any]]]]) – (experimental) The block devices to attach to the instance used for building, testing, and distributing the container image. Default: the block devices of the instance image will be usedinstance_image (
Optional[ContainerInstanceImage]) – (experimental) The image to use to launch the instance used for building, testing, and distributing the container image. Default: Image Builder will use the appropriate ECS-optimized AMIkms_key (
Optional[IKey]) – (experimental) The KMS key used to encrypt the dockerfile template. Default: Noneos_version (
Optional[OSVersion]) – (experimental) The operating system (OS) version of the base image. 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 (
Optional[Mapping[str,str]]) – (experimental) The tags to apply to the container recipe. Default: Noneworking_directory (
Optional[str]) – (experimental) The working directory for use during build and test workflows. 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:/
- Stability:
experimental
Methods
- add_instance_block_device(*instance_block_devices)
(experimental) Adds block devices to attach to the instance used for building, testing, and distributing the container image.
- Parameters:
instance_block_devices (
BlockDevice) –The list of block devices to attach.
- Stability:
experimental
- Return type:
None
- apply_removal_policy(policy)
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).- Parameters:
policy (
RemovalPolicy)- Return type:
None
- grant(grantee, *actions)
(experimental) Grant custom actions to the given grantee for the container recipe.
- Parameters:
grantee (
IGrantable) – The principal.actions (
str) – The list of actions.
- Stability:
experimental
- Return type:
- grant_read(grantee)
(experimental) Grant read permissions to the given grantee for the container recipe.
- Parameters:
grantee (
IGrantable) – The principal.- Stability:
experimental
- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- PROPERTY_INJECTION_ID = '@aws-cdk.aws-imagebuilder-alpha.ContainerRecipe'
- container_recipe_arn
(experimental) The ARN of the container recipe.
- Stability:
experimental
- container_recipe_name
(experimental) The name of the container recipe.
- Stability:
experimental
- container_recipe_version
(experimental) The version of the container recipe.
- Stability:
experimental
- env
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
The tree node.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_container_recipe_arn(scope, id, container_recipe_arn)
(experimental) Import an existing container recipe given its ARN.
- Parameters:
scope (
Construct)id (
str)container_recipe_arn (
str)
- Stability:
experimental
- Return type:
- classmethod from_container_recipe_attributes(scope, id, *, container_recipe_arn=None, container_recipe_name=None, container_recipe_version=None)
(experimental) 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.
- Parameters:
scope (
Construct)id (
str)container_recipe_arn (
Optional[str]) – (experimental) The ARN of the container recipe. Default: - derived from containerRecipeNamecontainer_recipe_name (
Optional[str]) – (experimental) The name of the container recipe. Default: - derived from containerRecipeArncontainer_recipe_version (
Optional[str]) – (experimental) The version of the container recipe. Default: - derived from containerRecipeArn. if a containerRecipeName is provided, the latest version, x.x.x, will be used.
- Stability:
experimental
- Return type:
- classmethod from_container_recipe_name(scope, id, container_recipe_name)
(experimental) 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.
- Parameters:
scope (
Construct)id (
str)container_recipe_name (
str)
- Stability:
experimental
- Return type:
- classmethod is_construct(x)
Checks if
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill behave unpredictably. It is safest to avoid usinginstanceof, and using this type-testing method instead.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsConstruct.
- classmethod is_container_recipe(x)
(experimental) Return whether the given object is a ContainerRecipe.
- Parameters:
x (
Any)- Stability:
experimental
- Return type:
bool
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct)- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct)- Return type:
bool