AWS Image Builder Infrastructure Configuration

This page shows how to write Terraform and CloudFormation for Image Builder Infrastructure Configuration and write them securely.

aws_imagebuilder_infrastructure_configuration (Terraform)

The Infrastructure Configuration in Image Builder can be configured in Terraform with the resource name aws_imagebuilder_infrastructure_configuration. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "aws_imagebuilder_infrastructure_configuration" "example" {
  description                   = "example description"
  instance_profile_name         = aws_iam_instance_profile.example.name
  instance_types                = ["t2.nano", "t3.micro"]
  key_pair                      = aws_key_pair.example.key_name
  name                          = "example"
2-infr-config.tf#L1
resource "aws_imagebuilder_infrastructure_configuration" "this" {
  description                   = "Simple infrastructure configuration"
  instance_profile_name         = var.ec2_iam_role_name
  instance_types                = ["t2.micro"]
  key_pair                      = var.aws_key_pair_name
  name                          = "amazon-linux-infr"
infra.tf#L59
resource "aws_imagebuilder_infrastructure_configuration" "instance" {
  description           = "PyApp-infra"
  instance_profile_name = aws_iam_instance_profile.test_profile.name
  instance_types = [
  "t2.micro"]
  key_pair = data.terraform_remote_state.admin.outputs.key
aws_imagebuilder_infrastructure_configuration.examplea.tf#L1
resource "aws_imagebuilder_infrastructure_configuration" "examplea" {
  description           = "examplea description"
  instance_profile_name = aws_iam_instance_profile.examplea.name
  instance_types        = ["t2.nano", "t3.micro"]
  // key_pair                      = aws_key_pair.example.key_name
  name = "examplea"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an Image Builder Infrastructure Configuration.

AWS::ImageBuilder::InfrastructureConfiguration (CloudFormation)

The InfrastructureConfiguration in ImageBuilder can be configured in CloudFormation with the resource name AWS::ImageBuilder::InfrastructureConfiguration. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

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.

Frequently asked questions

What is AWS Image Builder Infrastructure Configuration?

AWS Image Builder Infrastructure Configuration is a resource for Image Builder of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Image Builder Infrastructure Configuration?

For Terraform, the johngraham660/terraform-aws-ec2imagebuilder, masterwali/ec2-image-builder and KonovalovAlexey/terraform-modules source code examples are useful. See the Terraform Example section for further details.