AWS::ImageBuilder::InfrastructureConfiguration - AWS CloudFormation

AWS::ImageBuilder::InfrastructureConfiguration

Creates a new infrastructure configuration. An infrastructure configuration defines the environment in which your image will be built and tested.

Syntax

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

JSON

{ "Type" : "AWS::ImageBuilder::InfrastructureConfiguration", "Properties" : { "Description" : String, "InstanceMetadataOptions" : InstanceMetadataOptions, "InstanceProfileName" : String, "InstanceTypes" : [ String, ... ], "KeyPair" : String, "Logging" : Logging, "Name" : String, "Placement" : Placement, "ResourceTags" : {Key: Value, ...}, "SecurityGroupIds" : [ String, ... ], "SnsTopicArn" : String, "SubnetId" : String, "Tags" : {Key: Value, ...}, "TerminateInstanceOnFailure" : Boolean } }

YAML

Type: AWS::ImageBuilder::InfrastructureConfiguration Properties: Description: String InstanceMetadataOptions: InstanceMetadataOptions InstanceProfileName: String InstanceTypes: - String KeyPair: String Logging: Logging Name: String Placement: Placement ResourceTags: Key: Value SecurityGroupIds: - String SnsTopicArn: String SubnetId: String Tags: Key: Value TerminateInstanceOnFailure: Boolean

Properties

Description

The description of the infrastructure configuration.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

InstanceMetadataOptions

The instance metadata options that you can set for the HTTP requests that pipeline builds use to launch EC2 build and test instances.

Required: No

Type: InstanceMetadataOptions

Update requires: No interruption

InstanceProfileName

The instance profile to associate with the instance used to customize your Amazon EC2 AMI.

Required: Yes

Type: String

Pattern: ^[\w+=,.@-]+$

Minimum: 1

Maximum: 256

Update requires: No interruption

InstanceTypes

The instance types of the infrastructure configuration. You can specify one or more instance types to use for this build. The service will pick one of these instance types based on availability.

Required: No

Type: Array of String

Update requires: No interruption

KeyPair

The key pair of the infrastructure configuration. You can use this to log on to and debug the instance used to create your image.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

Logging

The logging configuration of the infrastructure configuration.

Required: No

Type: Logging

Update requires: No interruption

Name

The name of the infrastructure configuration.

Required: Yes

Type: String

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

Update requires: Replacement

Placement

The instance placement settings that define where the instances that are launched from your image will run.

Required: No

Type: Placement

Update requires: No interruption

ResourceTags

The metadata tags to assign to the Amazon EC2 instance that Image Builder launches during the build process. Tags are formatted as key value pairs.

Required: No

Type: Object of String

Pattern: .{1,}

Update requires: No interruption

SecurityGroupIds

The security group IDs to associate with the instance used to customize your Amazon EC2 AMI.

Required: No

Type: Array of String

Update requires: No interruption

SnsTopicArn

The Amazon Resource Name (ARN) for the SNS topic to which we send image build event notifications.

Note

EC2 Image Builder is unable to send notifications to SNS topics that are encrypted using keys from other accounts. The key that is used to encrypt the SNS topic must reside in the account that the Image Builder service runs under.

Required: No

Type: String

Pattern: ^arn:aws[^:]*:sns:[^:]+:[0-9]{12}:[a-zA-Z0-9-_]{1,256}$

Update requires: No interruption

SubnetId

The subnet ID in which to place the instance used to customize your Amazon EC2 AMI.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

Tags

The metadata tags to assign to the infrastructure configuration resource that Image Builder creates as output. Tags are formatted as key value pairs.

Required: No

Type: Object of String

Pattern: .{1,}

Update requires: No interruption

TerminateInstanceOnFailure

The terminate instance on failure setting of the infrastructure configuration. Set to false if you want Image Builder to retain the instance used to configure your AMI if the build or test phase of your workflow fails.

Required: No

Type: Boolean

Update requires: No interruption

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:infrastructure-configuration/my-example-infrastructure.

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 infrastructure configuration. 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+)?)?$.

Name

The name of the infrastructure configuration.

Examples

Create an infrastructure configuration

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

JSON

{ "Resources": { "InfrastructureConfigurationAll": { "Type": "AWS::ImageBuilder::InfrastructureConfiguration", "Properties": { "Name": "infrastructure-configuration-name", "InstanceProfileName": "instance-profile-name", "Description": "description", "InstanceTypes": [ "m4.large", "m5.large" ], "KeyPair": "key-pair", "Logging": { "S3Logs": { "S3BucketName": "imagebuilder-logging-bucket", "S3KeyPrefix": "imagebuilder-bucket-prefix" } }, "SnsTopicArn": { "Ref": "SnsTopicArn" }, "TerminateInstanceOnFailure": true, "SecurityGroupIds": [ "security-group-id-1", "security-group-id-2" ], "SubnetId": "subnet-id", "Tags": { "CustomerInfraConfigTagKey1": "CustomerInfraConfigTagValue1", "CustomerInfraConfigTagKey2": "CustomerInfraConfigTagValue2" } } } } }

YAML

Resources: InfrastructureConfigurationAll: Type: 'AWS::ImageBuilder::InfrastructureConfiguration' Properties: Name: 'infrastructure-configuration-name' InstanceProfileName: 'instance-profile-name' Description: 'description' InstanceTypes: - 'm4.large' - 'm5.large' KeyPair: 'key-pair' Logging: S3Logs: S3BucketName: 'imagebuilder-logging-bucket' S3KeyPrefix: 'imagebuilder-bucket-prefix' SnsTopicArn: !Ref SnsTopicArn TerminateInstanceOnFailure: true SecurityGroupIds: - 'security-group-id-1' - 'security-group-id-2' SubnetId: 'subnet-id' Tags: CustomerInfraConfigTagKey1: 'CustomerInfraConfigTagValue1' CustomerInfraConfigTagKey2: 'CustomerInfraConfigTagValue2'