This is the new AWS 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 AWS 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. Recipes require a minimum of one build component, and can have a maximum of 20 build and test components in any combination.
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-
Dockerfiles are text documents that are used to build Docker containers, and ensure that they contain all of the elements required by the application running inside. The template data consists of contextual variables where Image Builder places build information or scripts, based on your container image recipe.
Required: No
Type: String
Update requires: Replacement
DockerfileTemplateUri-
The S3 URI for the Dockerfile that will be used to build your container image.
Required: No
Type: String
Update requires: Replacement
ImageOsVersionOverride-
Specifies the operating system version for the base image.
Required: No
Type: String
Update 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 Amazon Resource Name (ARN) that uniquely identifies which KMS key is used to encrypt the container image for distribution to the target Region. 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.
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.
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.
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, with an upper limit of 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.
Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in any node, all nodes to the right of the first wildcard must also be wildcards.
Required: No
Type: String
Pattern:
^[0-9]+\.[0-9]+\.[0-9]+$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:123456789012: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:123456789012:container-recipe/mybasicrecipe/2020.12.17. Name-
Returns the name of the container recipe.
Examples
Create a container recipe.
The following example shows the schema for the ContainerRecipe resource document 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" ] } } } }