

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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::ImageBuilder::ContainerRecipe
<a name="aws-resource-imagebuilder-containerrecipe"></a>

Creates a new container recipe. Container recipes define how images are configured, tested, and assessed.

## Syntax
<a name="aws-resource-imagebuilder-containerrecipe-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-imagebuilder-containerrecipe-syntax.json"></a>

```
{
  "Type" : "AWS::ImageBuilder::ContainerRecipe",
  "Properties" : {
      "[Components](#cfn-imagebuilder-containerrecipe-components)" : [ ComponentConfiguration, ... ],
      "[ContainerType](#cfn-imagebuilder-containerrecipe-containertype)" : String,
      "[Description](#cfn-imagebuilder-containerrecipe-description)" : String,
      "[DockerfileTemplateData](#cfn-imagebuilder-containerrecipe-dockerfiletemplatedata)" : String,
      "[DockerfileTemplateUri](#cfn-imagebuilder-containerrecipe-dockerfiletemplateuri)" : String,
      "[ImageOsVersionOverride](#cfn-imagebuilder-containerrecipe-imageosversionoverride)" : String,
      "[InstanceConfiguration](#cfn-imagebuilder-containerrecipe-instanceconfiguration)" : InstanceConfiguration,
      "[KmsKeyId](#cfn-imagebuilder-containerrecipe-kmskeyid)" : String,
      "[Name](#cfn-imagebuilder-containerrecipe-name)" : String,
      "[ParentImage](#cfn-imagebuilder-containerrecipe-parentimage)" : String,
      "[PlatformOverride](#cfn-imagebuilder-containerrecipe-platformoverride)" : String,
      "[Tags](#cfn-imagebuilder-containerrecipe-tags)" : {Key: Value, ...},
      "[TargetRepository](#cfn-imagebuilder-containerrecipe-targetrepository)" : TargetContainerRepository,
      "[Version](#cfn-imagebuilder-containerrecipe-version)" : String,
      "[WorkingDirectory](#cfn-imagebuilder-containerrecipe-workingdirectory)" : String
    }
}
```

### YAML
<a name="aws-resource-imagebuilder-containerrecipe-syntax.yaml"></a>

```
Type: AWS::ImageBuilder::ContainerRecipe
Properties:
  [Components](#cfn-imagebuilder-containerrecipe-components): 
    - ComponentConfiguration
  [ContainerType](#cfn-imagebuilder-containerrecipe-containertype): String
  [Description](#cfn-imagebuilder-containerrecipe-description): String
  [DockerfileTemplateData](#cfn-imagebuilder-containerrecipe-dockerfiletemplatedata): String
  [DockerfileTemplateUri](#cfn-imagebuilder-containerrecipe-dockerfiletemplateuri): String
  [ImageOsVersionOverride](#cfn-imagebuilder-containerrecipe-imageosversionoverride): String
  [InstanceConfiguration](#cfn-imagebuilder-containerrecipe-instanceconfiguration): 
    InstanceConfiguration
  [KmsKeyId](#cfn-imagebuilder-containerrecipe-kmskeyid): String
  [Name](#cfn-imagebuilder-containerrecipe-name): String
  [ParentImage](#cfn-imagebuilder-containerrecipe-parentimage): String
  [PlatformOverride](#cfn-imagebuilder-containerrecipe-platformoverride): String
  [Tags](#cfn-imagebuilder-containerrecipe-tags): 
    Key: Value
  [TargetRepository](#cfn-imagebuilder-containerrecipe-targetrepository): 
    TargetContainerRepository
  [Version](#cfn-imagebuilder-containerrecipe-version): String
  [WorkingDirectory](#cfn-imagebuilder-containerrecipe-workingdirectory): String
```

## Properties
<a name="aws-resource-imagebuilder-containerrecipe-properties"></a>

`Components`  <a name="cfn-imagebuilder-containerrecipe-components"></a>
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](aws-properties-imagebuilder-containerrecipe-componentconfiguration.md)  
*Minimum*: `1`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ContainerType`  <a name="cfn-imagebuilder-containerrecipe-containertype"></a>
Specifies the type of container, such as Docker.  
*Required*: No  
*Type*: String  
*Allowed values*: `DOCKER`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Description`  <a name="cfn-imagebuilder-containerrecipe-description"></a>
The description of the container recipe.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `1024`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`DockerfileTemplateData`  <a name="cfn-imagebuilder-containerrecipe-dockerfiletemplatedata"></a>
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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`DockerfileTemplateUri`  <a name="cfn-imagebuilder-containerrecipe-dockerfiletemplateuri"></a>
The S3 URI for the Dockerfile that will be used to build your container image.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ImageOsVersionOverride`  <a name="cfn-imagebuilder-containerrecipe-imageosversionoverride"></a>
Specifies the operating system version for the base image.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`InstanceConfiguration`  <a name="cfn-imagebuilder-containerrecipe-instanceconfiguration"></a>
A group of options that can be used to configure an instance for building and testing container images.  
*Required*: No  
*Type*: [InstanceConfiguration](aws-properties-imagebuilder-containerrecipe-instanceconfiguration.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`KmsKeyId`  <a name="cfn-imagebuilder-containerrecipe-kmskeyid"></a>
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)](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN) in the *AWS Key Management Service Developer Guide*.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `1024`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-imagebuilder-containerrecipe-name"></a>
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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ParentImage`  <a name="cfn-imagebuilder-containerrecipe-parentimage"></a>
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*: `1`  
*Maximum*: `1024`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`PlatformOverride`  <a name="cfn-imagebuilder-containerrecipe-platformoverride"></a>
Specifies the operating system platform when you use a custom base image.  
*Required*: No  
*Type*: String  
*Allowed values*: `Windows | Linux`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Tags`  <a name="cfn-imagebuilder-containerrecipe-tags"></a>
Tags that are attached to the container recipe.  
*Required*: No  
*Type*: Object of String  
*Pattern*: `.{1,}`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TargetRepository`  <a name="cfn-imagebuilder-containerrecipe-targetrepository"></a>
The destination repository for the container image.  
*Required*: No  
*Type*: [TargetContainerRepository](aws-properties-imagebuilder-containerrecipe-targetcontainerrepository.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Version`  <a name="cfn-imagebuilder-containerrecipe-version"></a>
The semantic version of the container recipe. This version follows the semantic version syntax.  
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.
*Required*: No  
*Type*: String  
*Pattern*: `^(?:[0-9]+|x)\.(?:[0-9]+|x)\.(?:[0-9]+|x)$`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`WorkingDirectory`  <a name="cfn-imagebuilder-containerrecipe-workingdirectory"></a>
The working directory for use during build and test workflows.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `1024`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-imagebuilder-containerrecipe-return-values"></a>

### Ref
<a name="aws-resource-imagebuilder-containerrecipe-return-values-ref"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-imagebuilder-containerrecipe-return-values-fn--getatt"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-imagebuilder-containerrecipe-return-values-fn--getatt-fn--getatt"></a>

`Arn`  <a name="Arn-fn::getatt"></a>
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`.

`LatestVersion.Arn`  <a name="LatestVersion.Arn-fn::getatt"></a>
The latest version Amazon Resource Name (ARN) of the Image Builder resource.

`LatestVersion.Major`  <a name="LatestVersion.Major-fn::getatt"></a>
The latest version Amazon Resource Name (ARN) with the same `major` version of the Image Builder resource.

`LatestVersion.Minor`  <a name="LatestVersion.Minor-fn::getatt"></a>
The latest version Amazon Resource Name (ARN) with the same `minor` version of the Image Builder resource.

`LatestVersion.Patch`  <a name="LatestVersion.Patch-fn::getatt"></a>
The latest version Amazon Resource Name (ARN) with the same `patch` version of the Image Builder resource.

`Name`  <a name="Name-fn::getatt"></a>
Returns the name of the container recipe.

## Examples
<a name="aws-resource-imagebuilder-containerrecipe--examples"></a>



### Create a container recipe.
<a name="aws-resource-imagebuilder-containerrecipe--examples--Create_a_container_recipe."></a>

The following example shows the schema for the ContainerRecipe resource document in both YAML and JSON format.

#### YAML
<a name="aws-resource-imagebuilder-containerrecipe--examples--Create_a_container_recipe.--yaml"></a>

```
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
<a name="aws-resource-imagebuilder-containerrecipe--examples--Create_a_container_recipe.--json"></a>

```
{
   "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"
            ]
         }
      }
   }
}
```