AWS::ImageBuilder::ImageRecipe - AWS CloudFormation

AWS::ImageBuilder::ImageRecipe

An Image Builder image recipe is a document that defines the base image and the components to be applied to the base image to produce the desired configuration for the output image. You can use an image recipe to duplicate builds. Image Builder image recipes can be shared, branched, and edited using the console wizard, the AWS CLI, or the API. You can use image recipes with your version control software to maintain shareable versioned image recipes.

Syntax

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

JSON

{ "Type" : "AWS::ImageBuilder::ImageRecipe", "Properties" : { "AdditionalInstanceConfiguration" : AdditionalInstanceConfiguration, "BlockDeviceMappings" : [ InstanceBlockDeviceMapping, ... ], "Components" : [ ComponentConfiguration, ... ], "Description" : String, "Name" : String, "ParentImage" : String, "Tags" : {Key: Value, ...}, "Version" : String, "WorkingDirectory" : String } }

Properties

AdditionalInstanceConfiguration

Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your image configuration. Instance configuration adds a layer of control over those instances. You can define settings and add scripts to run when an instance is launched from your AMI.

Required: No

Type: AdditionalInstanceConfiguration

Update requires: No interruption

BlockDeviceMappings

The block device mappings to apply when creating images from this recipe.

Required: No

Type: Array of InstanceBlockDeviceMapping

Update requires: Replacement

Components

The components of the image recipe. Components are orchestration documents that define a sequence of steps for downloading, installing, configuring, and testing software packages. They also define validation and security hardening steps. A component is defined using a YAML document format.

Required: Yes

Type: Array of ComponentConfiguration

Minimum: 1

Update requires: Replacement

Description

The description of the image recipe.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

Name

The name of the image recipe.

Required: Yes

Type: String

Pattern: ^[-_A-Za-z-0-9][-_A-Za-z0-9 ]{1,126}[-_A-Za-z-0-9]$

Update requires: Replacement

ParentImage

The parent image of the image recipe. The string must be either an Image ARN or an AMI ID.

Required: Yes

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

Tags

The tags of the image recipe.

Required: No

Type: Object of String

Pattern: .{1,}

Update requires: Replacement

Version

The semantic version of the image recipe.

Required: Yes

Type: String

Pattern: ^[0-9]+\.[0-9]+\.[0-9]+$

Update requires: Replacement

WorkingDirectory

The working directory to be used during build and test workflows.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update 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:image-recipe/mybasicrecipe/2019.12.03.

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 image recipe. For example, arn:aws:imagebuilder:us-east-1:123456789012:image-recipe/mybasicrecipe/2019.12.03.

Name

The name of the image recipe.

Examples

Create an image recipe

The following example shows the schema for all of the parameters of the ImageRecipe resource document in both YAML and JSON format .

YAML

Resources: ImageRecipeAllParameters: Type: 'AWS::ImageBuilder::ImageRecipe' Properties: Name: 'image-recipe-name' Version: '1.0.0' ParentImage: !Ref ParentImage Description: 'description' Components: - ComponentArn: !Ref ComponentArn - ComponentArn: !Ref AnotherComponentArn BlockDeviceMappings: - DeviceName: "device-name" VirtualName: "virtual-name" Ebs: DeleteOnTermination: true Encrypted: true Iops: 100 KmsKeyId: !Ref KmsKeyId SnapshotId: "snapshot-id" VolumeType: "gp2" VolumeSize: 100 Tags: CustomerImageRecipeTagKey1: 'CustomerImageRecipeTagValue1' CustomerImageRecipeTagKey2: 'CustomerImageRecipeTagValue2'

JSON

{ "Resources": { "ImageRecipeAllParameters": { "Type": "AWS::ImageBuilder::ImageRecipe", "Properties": { "Name": "image-recipe-name", "Version": "1.0.0", "ParentImage": { "Ref": "ParentImage" }, "Description": "description", "Components": [ { "ComponentArn": { "Ref": "ComponentArn" } }, { "ComponentArn": { "Ref": "AnotherComponentArn" } } ], "BlockDeviceMappings": [ { "DeviceName": "device-name", "VirtualName": "virtual-name", "Ebs": { "DeleteOnTermination": true, "Encrypted": true, "Iops": 100, "KmsKeyId": { "Ref": "KmsKeyId" }, "SnapshotId": "snapshot-id", "VolumeType": "gp2", "VolumeSize": 100 } } ], "Tags": { "CustomerImageRecipeTagKey1": "CustomerImageRecipeTagValue1", "CustomerImageRecipeTagKey2": "CustomerImageRecipeTagValue2" } } } } }

See also