AWS::ImageBuilder::Component - AWS CloudFormation

AWS::ImageBuilder::Component

Components are orchestration documents that define a sequence of steps for downloading, installing, and configuring software packages or for defining tests to run on software packages. They also define validation and security hardening steps. A component is defined using a YAML document format. For more information, see Using Documents in EC2 Image Builder.

Syntax

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

JSON

{ "Type" : "AWS::ImageBuilder::Component", "Properties" : { "ChangeDescription" : String, "Data" : String, "Description" : String, "KmsKeyId" : String, "Name" : String, "Platform" : String, "SupportedOsVersions" : [ String, ... ], "Tags" : {Key : Value, ...}, "Uri" : String, "Version" : String } }

YAML

Type: AWS::ImageBuilder::Component Properties: ChangeDescription: String Data: String Description: String KmsKeyId: String Name: String Platform: String SupportedOsVersions: - String Tags: Key : Value Uri: String Version: String

Properties

ChangeDescription

A change description of the component. For example initial version.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

Data

The data of the component. For example, name: HelloWorldTestingDocument\ndescription: This is hello world testing document.\nschemaVersion: 1.0\n\nphases:\n - name: test\n steps:\n - name: HelloWorldStep\n action: ExecuteBash\n inputs:\n commands:\n - echo \"Hello World! Test.\"\n. See Examples below for the schema for creating a component using Data.

Required: No

Type: String

Update requires: Replacement

Description

The description of the component.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

KmsKeyId

The KMS key identifier used to encrypt the component.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: Replacement

Name

The name of the component.

Required: Yes

Type: String

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

Update requires: Replacement

Platform

The platform of the component. For example, Windows.

Required: Yes

Type: String

Allowed values: Linux | Windows

Update requires: Replacement

SupportedOsVersions

The operating system (OS) version supported by the component. If the OS information is available, a prefix match is performed against the parent image OS version during image recipe creation.

Required: No

Type: List of String

Maximum: 25

Update requires: Replacement

Tags

The tags associated with the component.

Required: No

Type: Map of String

Update requires: Replacement

Uri

The URI of the component document.

Required: No

Type: String

Update requires: Replacement

Version

The component version. For example, 1.0.0.

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:123456789012:component/examplecomponent/2019.12.02/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

Returns the Amazon Resource Name (ARN) of the component. The following pattern is applied: ^arn:aws[^:]*:imagebuilder:[^:]+:(?:\d{12}|aws):(?:image-recipe|infrastructure-configuration|distribution-configuration|component|image|image-pipeline)/[a-z0-9-_]+(?:/(?:(?:x|\d+)\.(?:x|\d+)\.(?:x|\d+))(?:/\d+)?)?$.

Encrypted

Returns the encryption status of the component. For example true or false.

Type

Returns the component type. For example, BUILD or TEST.

Examples

Create a component using Data

The following example shows the schema for the Component resource document in both YAML and JSON format. This example includes details for the Data field . You can use either the Data or Uri fields to reference the component document.

YAML

Resources: ComponentAllParameters: Type: 'AWS::ImageBuilder::Component' Properties: Name: 'component-name' Platform: 'Linux' Version: "1.0.0" Description: 'description' ChangeDescription: 'change-description' KmsKeyId: 'customer-kms-key-id' Tags: CustomerComponentTagKey1: 'CustomerComponentTagValue1' CustomerComponentTagKey2: 'CustomerComponentTagValue2' # Require one of 'Data' or 'Uri' for Component template Data: | name: HelloWorldTestingLinuxDoc - InlineData description: This is hello world testing doc schemaVersion: 1.0 phases: - name: build steps: - name: HelloWorldStep action: ExecuteBash inputs: commands: - echo "Hello World! Build." - name: validate steps: - name: HelloWorldStep action: ExecuteBash inputs: commands: - echo "Hello World! Validate." - name: test steps: - name: HelloWorldStep action: ExecuteBash inputs: commands: - echo "Hello World! Test."

JSON

{ "Resources": { "ComponentAllParameters": { "Type": "AWS::ImageBuilder::Component", "Properties": { "Name": "component-name", "Platform": "Linux", "Version": "1.0.0", "Description": "description", "ChangeDescription": "change-description", "KmsKeyId": "customer-kms-key-id", "Tags": { "CustomerComponentTagKey1": "CustomerComponentTagValue1", "CustomerComponentTagKey2": "CustomerComponentTagValue2" }, "Data": "name: HelloWorldTestingLinuxDoc - InlineData\ndescription: This is hello world testing doc\nschemaVersion: 1.0\n\nphases:\n - name: build\n steps:\n - name: HelloWorldStep\n action: ExecuteBash\n inputs:\n commands:\n - echo \"Hello World! Build.\"\n - name: validate\n steps:\n - name: HelloWorldStep\n action: ExecuteBash\n inputs:\n commands:\n - echo \"Hello World! Validate.\"\n - name: test\n steps:\n - name: HelloWorldStep\n action: ExecuteBash\n inputs:\n commands:\n - echo \"Hello World! Test.\"\n" } } } }

Create a component using a Uri

The following example shows the schema for the Component resource document in both YAML and JSON format. This example includes details for the Uri field . You can use either the Data or Uri fields to reference the component document.

YAML

Resources: ComponentAllParameters: Type: 'AWS::ImageBuilder::Component' Properties: Name: 'component-name' Platform: 'Linux' Version: "1.0.0" # Require one of 'Data' or 'Uri' for Component template Uri: 's3://imagebuilder/component_document.yml' Description: 'description' ChangeDescription: 'change-description' KmsKeyId: 'customer-kms-key-id' Tags: CustomerComponentTagKey1: 'CustomerComponentTagValue1' CustomerComponentTagKey2: 'CustomerComponentTagValue2'

JSON

{ "Resources": { "ComponentAllParameters": { "Type": "AWS::ImageBuilder::Component", "Properties": { "Name": "component-name", "Platform": "Linux", "Version": "1.0.0", "Uri": "s3://imagebuilder/component_document.yml", "Description": "description", "ChangeDescription": "change-description", "KmsKeyId": "customer-kms-key-id", "Tags": { "CustomerComponentTagKey1": "CustomerComponentTagValue1", "CustomerComponentTagKey2": "CustomerComponentTagValue2" } } } } }