AWS::ImageBuilder::InfrastructureConfiguration - AWS CloudFormation

AWS::ImageBuilder::InfrastructureConfiguration

The infrastructure configuration allows you to specify the infrastructure within which to build and test your image. In the infrastructure configuration, you can specify instance types, subnets, and security groups to associate with your instance. You can also associate an Amazon EC2 key pair with the instance used to build your image. This allows you to log on to your instance to troubleshoot if your build fails and you set terminateInstanceOnFailure to false.

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, "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 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 option settings for the infrastructure configuration.

Required: No

Type: InstanceMetadataOptions

Update requires: No interruption

InstanceProfileName

The instance profile of the infrastructure configuration.

Required: Yes

Type: String

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

Minimum: 1

Maximum: 256

Update requires: No interruption

InstanceTypes

The instance types of the infrastructure configuration.

Required: No

Type: Array of String

Update requires: No interruption

KeyPair

The Amazon EC2 key pair of the infrastructure configuration.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

Logging

The logging configuration defines where Image Builder uploads your logs.

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

ResourceTags

The tags attached to the resource created by Image Builder.

Required: No

Type: Object of String

Pattern: .{1,}

Update requires: No interruption

SecurityGroupIds

The security group IDs of the infrastructure configuration.

Required: No

Type: Array of String

Update requires: No interruption

SnsTopicArn

The Amazon Resource Name (ARN) of the SNS topic for the infrastructure configuration.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

SubnetId

The subnet ID of the infrastructure configuration.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

Tags

The tags of the infrastructure configuration.

Required: No

Type: Object of String

Pattern: .{1,}

Update requires: No interruption

TerminateInstanceOnFailure

The terminate instance on failure configuration of the infrastructure configuration.

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'