This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.
AWS::ImageBuilder::ContainerRecipe
Creates a new container recipe. Container recipes define how images are configured, tested, and assessed.
Syntax
To declare this entity in your CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::ImageBuilder::ContainerRecipe", "Properties" : { "Components" :[ ComponentConfiguration, ... ], "ContainerType" :String, "Description" :String, "DockerfileTemplateData" :String, "DockerfileTemplateUri" :String, "ImageOsVersionOverride" :String, "InstanceConfiguration" :InstanceConfiguration, "KmsKeyId" :String, "Name" :String, "ParentImage" :String, "PlatformOverride" :String, "Tags" :{, "TargetRepository" :Key:Value, ...}TargetContainerRepository, "Version" :String, "WorkingDirectory" :String} }
YAML
Type: AWS::ImageBuilder::ContainerRecipe Properties: Components:- ComponentConfigurationContainerType:StringDescription:StringDockerfileTemplateData:StringDockerfileTemplateUri:StringImageOsVersionOverride:StringInstanceConfiguration:InstanceConfigurationKmsKeyId:StringName:StringParentImage:StringPlatformOverride:StringTags:TargetRepository:Key:ValueTargetContainerRepositoryVersion:StringWorkingDirectory:String
Properties
Components-
Build and test components that are included in the container recipe. A recipe can contain a maximum of 20 build and test components in any combination, by default. This maximum is an adjustable quota. For more information, see EC2 Image Builder endpoints and quotas in the AWS General Reference.
Required: No
Type: Array of ComponentConfiguration
Minimum:
1Update requires: Replacement
ContainerType-
Specifies the type of container, such as Docker.
Required: No
Type: String
Allowed values:
DOCKERUpdate requires: Replacement
Description-
The description of the container recipe.
Required: No
Type: String
Minimum:
1Maximum:
1024Update requires: Replacement
DockerfileTemplateData-
The Dockerfile template that Image Builder uses to build the container image. The template can include contextual variables that Image Builder replaces with build information at build time. For the contextual variables that the template can include, see Create a new version of a container recipe in the EC2 Image Builder User Guide.
Required: No
Type: String
Update requires: Replacement
DockerfileTemplateUri-
The Amazon S3 URI for the Dockerfile template that is used to build your container image. You must have permission to read the object. Image Builder reads the object once, when it creates the recipe, and stores its content in the recipe. Later changes to the S3 object don't affect the recipe. You must specify exactly one of the
dockerfileTemplateDataordockerfileTemplateUriproperties.Required: No
Type: String
Update requires: Replacement
ImageOsVersionOverride-
Specifies the operating system version for the base image. Use this property only when the base image is a container image from a registry. When the base image is an Image Builder image, the operating system version comes from the parent image.
Required: No
Type: String
Minimum:
1Maximum:
1024Update requires: Replacement
InstanceConfiguration-
A group of options that can be used to configure an instance for building and testing container images.
Required: No
Type: InstanceConfiguration
Update requires: Replacement
KmsKeyId-
The KMS key that Image Builder uses to encrypt the recipe's Dockerfile template data at rest. This can be either the Key ARN or the Alias ARN. For more information, see Key identifiers (KeyId) in the AWS Key Management Service Developer Guide. If you don't specify a key, Image Builder encrypts the template data with a KMS key that Image Builder owns. This key isn't used to encrypt the output container image.
Required: No
Type: String
Minimum:
1Maximum:
1024Update requires: Replacement
Name-
The name of the container recipe.
Required: No
Type: String
Pattern:
^[-_A-Za-z-0-9][-_A-Za-z0-9 ]{1,126}[-_A-Za-z-0-9]$Update requires: Replacement
ParentImage-
The base image for customizations specified in the container recipe. This can contain an Image Builder image resource ARN or a container image URI, for example
amazonlinux:latest.Required: No
Type: String
Minimum:
1Maximum:
1024Update requires: Replacement
PlatformOverride-
Specifies the operating system platform when you use a custom base image. Container recipes support only the Linux and Windows platforms.
Required: No
Type: String
Allowed values:
Windows | LinuxUpdate requires: Replacement
-
Tags that are attached to the container recipe.
Required: No
Type: Object of String
Pattern:
.{1,}Update requires: No interruption
TargetRepository-
The destination repository for the container image.
Required: No
Type: TargetContainerRepository
Update requires: Replacement
Version-
The semantic version of the container recipe. This version follows the semantic version syntax.
Note
The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign values for the first three, and can filter on all of them.
Assignment: For the first three nodes, you can assign any positive integer value, including zero. The upper limit is 2^30-1, or 1073741823, for each node. Image Builder automatically assigns the build number to the fourth node.
Patterns: You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.
Required: No
Type: String
Pattern:
^(?:[0-9]+|x)\.(?:[0-9]+|x)\.(?:[0-9]+|x)$Update requires: Replacement
WorkingDirectory-
The working directory for use during build and test workflows.
Required: No
Type: String
Minimum:
1Maximum:
1024Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the resource ARN, such as
arn:aws:imagebuilder:us-east-1:111122223333:container-recipe/mybasicrecipe/2020.12.17.
For more information about using the Ref function, see Ref.
Fn::GetAtt
The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.
Arn-
Returns the Amazon Resource Name (ARN) of the container recipe. For example,
arn:aws:imagebuilder:us-east-1:111122223333:container-recipe/mybasicrecipe/2020.12.17. LatestVersion.Arn-
The latest version Amazon Resource Name (ARN) of the Image Builder resource.
LatestVersion.Major-
The latest version Amazon Resource Name (ARN) with the same
majorversion of the Image Builder resource. LatestVersion.Minor-
The latest version Amazon Resource Name (ARN) with the same
minorversion of the Image Builder resource. LatestVersion.Patch-
The latest version Amazon Resource Name (ARN) with the same
patchversion of the Image Builder resource. Name-
Returns the name of the container recipe.
Examples
Create a container recipe
The following example shows the template for the ContainerRecipe resource in both YAML and JSON format.
YAML
Resources: ContainerRecipeAllParameters: Type: 'AWS::ImageBuilder::ContainerRecipe' Properties: Name: 'container-recipe-name' Version: '1.0.0' ParentImage: !Ref ParentImage Description: 'description' ContainerType: 'DOCKER' Components: - ComponentArn: !Ref ComponentArn - ComponentArn: !Ref AnotherComponentArn TargetRepository: Service: 'ECR' RepositoryName: !Ref RepositoryName DockerfileTemplateData: | FROM {{{ imagebuilder:parentImage }}} {{{ imagebuilder:environments }}} {{{ imagebuilder:components }}} WorkingDirectory: "dummy-working-directory" KmsKeyId: !Ref KmsKeyId Tags: Usage: 'Documentation' Outputs: OutputContainerRecipeArn: Value: 'Fn::GetAtt': - ContainerRecipeAllParameters - Arn
JSON
{ "Resources": { "ContainerRecipeAllParameters": { "Type": "AWS::ImageBuilder::ContainerRecipe", "Properties": { "Name": "container-recipe-name", "Version": "1.0.0", "ParentImage": { "Ref": "ParentImage" }, "Description": "description", "ContainerType": "DOCKER", "Components": [ { "ComponentArn": { "Ref": "ComponentArn" } }, { "ComponentArn": { "Ref": "AnotherComponentArn" } } ], "TargetRepository": { "Service": "ECR", "RepositoryName": { "Ref": "RepositoryName" } }, "DockerfileTemplateData": "FROM {{{ imagebuilder:parentImage }}}\n{{{ imagebuilder:environments }}}\n{{{ imagebuilder:components }}}\n", "WorkingDirectory": "dummy-working-directory", "KmsKeyId": { "Ref": "KmsKeyId" }, "Tags": { "Usage": "Documentation" } } } }, "Outputs": { "OutputContainerRecipeArn": { "Value": { "Fn::GetAtt": [ "ContainerRecipeAllParameters", "Arn" ] } } } }
See also
-
Create a container recipe in the Image Builder User Guide.