View a markdown version of this page

AWS::ImageBuilder::Workflow - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

This is the new Amazon CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the Amazon CloudFormation User Guide.

AWS::ImageBuilder::Workflow

Creates a new workflow or a new version of an existing workflow. If a workflow with the same name and semantic version already exists, and your request changes its configuration, Image Builder creates a new build version. If the configuration is identical to the latest build version, the request fails because that workflow configuration already exists.

Syntax

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

JSON

{ "Type" : "AWS::ImageBuilder::Workflow", "Properties" : { "ChangeDescription" : String, "Data" : String, "Description" : String, "KmsKeyId" : String, "Name" : String, "Tags" : {Key: Value, ...}, "Type" : String, "Uri" : String, "Version" : String } }

YAML

Type: AWS::ImageBuilder::Workflow Properties: ChangeDescription: String Data: String Description: String KmsKeyId: String Name: String Tags: Key: Value Type: String Uri: String Version: String

Properties

ChangeDescription

Describes what change has been made in this version of the workflow, or what makes this version different from other versions of the workflow.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

Data

The UTF-8 encoded YAML document content for the workflow, up to 16,000 characters. For larger documents, store the document in Amazon S3 and specify the uri property instead. You must specify exactly one of the data or uri properties.

Required: No

Type: String

Minimum: 1

Maximum: 16000

Update requires: Replacement

Description

Describes the workflow.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

KmsKeyId

The Amazon Resource Name (ARN) that uniquely identifies the KMS key used to encrypt this workflow resource. This can be either the Key ARN or the Alias ARN. For more information, see Key identifiers (KeyId) in the Amazon Key Management Service Developer Guide. If you don't specify a key, Image Builder encrypts the workflow document with a KMS key that Image Builder owns.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

Name

The name of the workflow to create. Image Builder generates the workflow ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name. If a workflow with the same name and semantic version already exists in your account in the same Amazon Web Services Region, the request creates a new build version for it. If the content is also identical to the latest build version, the request fails because the workflow already exists.

Required: Yes

Type: String

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

Update requires: Replacement

Tags

Tags that apply to the workflow resource.

Required: No

Type: Object of String

Pattern: .{1,}

Update requires: No interruption

Type

The image creation stage that this workflow applies to. Image Builder validates the workflow document steps against the stage you specify.

Required: Yes

Type: String

Allowed values: BUILD | TEST | DISTRIBUTION

Update requires: Replacement

Uri

The uri of a YAML workflow document file stored in Amazon S3. This must be an S3 URL (s3://bucket/key), and you must have permission to access the S3 bucket it points to. A workflow document that you provide from Amazon S3 can be up to your service quota for workflow size.

Alternatively, you can specify the YAML document inline, using the workflow data property. You must specify exactly one of the data or uri properties.

Required: No

Type: String

Update requires: Replacement

Version

The semantic version of this workflow resource. The semantic version syntax adheres to the following rules.

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: Yes

Type: String

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

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-west-2:111122223333:workflow/build/my-example-workflow/1.0.0/1.

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

The Amazon Resource Name (ARN) of the workflow resource.

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 major version of the Image Builder resource.

LatestVersion.Minor

The latest version Amazon Resource Name (ARN) with the same minor version of the Image Builder resource.

LatestVersion.Patch

The latest version Amazon Resource Name (ARN) with the same patch version of the Image Builder resource.

Examples

Create a build workflow using inline Data

The following example creates a build workflow with inline YAML content. You can use either the Data or Uri property to provide the workflow document, but not both.

YAML

Resources: BuildWorkflow: Type: AWS::ImageBuilder::Workflow Properties: Name: my-build-workflow Version: '1.0.0' Type: BUILD Description: Custom build workflow ChangeDescription: Initial version Data: | name: my-build-workflow description: Custom build workflow schemaVersion: 1.0 steps: - name: LaunchBuildInstance action: LaunchInstance onFailure: Abort inputs: waitFor: ssmAgent - name: ApplyBuildComponents action: ExecuteComponents onFailure: Abort inputs: instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId - name: CreateOutputImage action: CreateImage onFailure: Abort inputs: instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId - name: TerminateBuildInstance action: TerminateInstance onFailure: Continue inputs: instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId Tags: Team: imaging

JSON

{ "Resources": { "BuildWorkflow": { "Type": "AWS::ImageBuilder::Workflow", "Properties": { "Name": "my-build-workflow", "Version": "1.0.0", "Type": "BUILD", "Description": "Custom build workflow", "ChangeDescription": "Initial version", "Data": "name: my-build-workflow\ndescription: Custom build workflow\nschemaVersion: 1.0\nsteps:\n - name: LaunchBuildInstance\n action: LaunchInstance\n onFailure: Abort\n inputs:\n waitFor: ssmAgent\n - name: ApplyBuildComponents\n action: ExecuteComponents\n onFailure: Abort\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n - name: CreateOutputImage\n action: CreateImage\n onFailure: Abort\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n - name: TerminateBuildInstance\n action: TerminateInstance\n onFailure: Continue\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n", "Tags": { "Team": "imaging" } } } } }

See also