AWS::ImageBuilder::ImageRecipe - AWS CloudFormation

AWS::ImageBuilder::ImageRecipe

Creates a new image recipe. Image 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::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 that are included in the image recipe. Recipes require a minimum of one build component, and can have a maximum of 20 build and test components in any combination.

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 base image for customizations specified in the image recipe. You can specify the parent image using one of the following options:

  • AMI ID

  • Image Builder image Amazon Resource Name (ARN)

  • AWS Systems Manager (SSM) Parameter Store Parameter, prefixed by ssm:, followed by the parameter name or ARN.

  • AWS Marketplace product 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 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