createInfrastructureConfiguration

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

Samples

// The following example creates an infrastructure configuration that gives Image Builder a choice of
// two instance types for its build and test instances.
val resp = imagebuilderClient.createInfrastructureConfiguration {
    name = "my-example-infrastructure"
    description = "An infrastructure configuration for Amazon Linux builds"
    instanceProfileName = "EC2InstanceProfileForImageBuilder"
    instanceTypes = listOf<String>(
        "t3.medium",
        "t3.large"
    )
    terminateInstanceOnFailure = true
    clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333"
}
// The following example creates an infrastructure configuration. It places your build and test
// instances in a single Availability Zone and requires IMDSv2 for instance metadata requests. It also applies
// resource tags to the resources that Image Builder creates during the build.
val resp = imagebuilderClient.createInfrastructureConfiguration {
    name = "my-example-infrastructure"
    description = "An infrastructure configuration that pins build instances to one Availability Zone and requires IMDSv2"
    instanceProfileName = "my-example-instance-role"
    placement = Placement {
        availabilityZone = "us-west-2a"
    }
    instanceMetadataOptions = InstanceMetadataOptions {
        httpTokens = "required"
        httpPutResponseHopLimit = 2
    }
    resourceTags = mapOf<String, String>(
        "CostCenter" to "12345",
        "Environment" to "test"
    )
    terminateInstanceOnFailure = true
    clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE98765"
}