Skip to content
v2.274.0

Experimental

@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

InfrastructureConfigurationProps Struct ​

Properties for creating an Infrastructure Configuration resource.

Example ​

ts
const infrastructureConfiguration = new imagebuilder.InfrastructureConfiguration(this, 'Infrastructure', {
  infrastructureConfigurationName: 'production-infrastructure',
  instanceTypes: [
    ec2.InstanceType.of(ec2.InstanceClass.COMPUTE7_INTEL, ec2.InstanceSize.LARGE)
  ],
  vpc: vpc,
  subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }
});

const distributionConfiguration = new imagebuilder.DistributionConfiguration(this, 'Distribution');
distributionConfiguration.addAmiDistributions({
  amiName: 'production-ami-{{ imagebuilder:buildDate }}',
  amiTargetAccountIds: ['123456789012', '098765432109']
});

const productionPipeline = new imagebuilder.ImagePipeline(this, 'ProductionPipeline', {
  recipe: exampleImageRecipe,
  infrastructureConfiguration: infrastructureConfiguration,
  distributionConfiguration: distributionConfiguration
});

Properties ​

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string= None#
The description of the infrastructure configuration.
ec2InstanceAvailabilityZoneoptionalstringec2_instance_availability_zoneoptionalstrec2InstanceAvailabilityZoneoptionalStringEc2InstanceAvailabilityZoneoptionalstringEc2InstanceAvailabilityZoneoptional*string#
The availability zone to place Image Builder build and test EC2 instances.

Default: EC2 will select a random zone

ec2InstanceHostIdoptionalstringec2_instance_host_idoptionalstrec2InstanceHostIdoptionalStringEc2InstanceHostIdoptionalstringEc2InstanceHostIdoptional*string= None#
The ID of the Dedicated Host on which build and test instances run.

This only applies if the instance tenancy is host. This cannot be used with the ec2InstanceHostResourceGroupArn parameter.

ec2InstanceHostResourceGroupArnoptionalstringec2_instance_host_resource_group_arnoptionalstrec2InstanceHostResourceGroupArnoptionalStringEc2InstanceHostResourceGroupArnoptionalstringEc2InstanceHostResourceGroupArnoptional*string= None#
The ARN of the host resource group on which build and test instances run.

This only applies if the instance tenancy is host. This cannot be used with the ec2InstanceHostId parameter.

ec2InstanceTenancyoptionalTenancyec2_instance_tenancyoptionalTenancyec2InstanceTenancyoptionalTenancyEc2InstanceTenancyoptionalTenancyEc2InstanceTenancyoptionalTenancy= Tenancy.DEFAULT#
The tenancy of the instance.

Dedicated tenancy runs instances on single-tenant hardware, while host tenancy runs instances on a dedicated host. Shared tenancy is used by default.

httpPutResponseHopLimitoptionalnumberhttp_put_response_hop_limitoptionalint | floathttpPutResponseHopLimitoptionalNumberHttpPutResponseHopLimitoptionaldoubleHttpPutResponseHopLimitoptional*float64= 2#
The maximum number of hops that an instance metadata request can traverse to reach its destination.

By default, this is set to 2.

httpTokensoptionalHttpTokenshttp_tokensoptionalHttpTokenshttpTokensoptionalHttpTokensHttpTokensoptionalHttpTokensHttpTokensoptionalHttpTokens= HttpTokens.REQUIRED#
Indicates whether a signed token header is required for instance metadata retrieval requests.

By default, this is set to required to require IMDSv2 on build and test EC2 instances.

infrastructureConfigurationNameoptionalstringinfrastructure_configuration_nameoptionalstrinfrastructureConfigurationNameoptionalStringInfrastructureConfigurationNameoptionalstringInfrastructureConfigurationNameoptional*string#
The name of the infrastructure configuration.

Default: A name is generated

This name must be normalized by transforming all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.

instanceProfileoptionalIInstanceProfileinstance_profileoptionalIInstanceProfileinstanceProfileoptionalIInstanceProfileInstanceProfileoptionalIInstanceProfileInstanceProfileoptionalIInstanceProfile#
The instance profile to associate with the instance used to customize the AMI.

Default: An instance profile will be generated

notes

By default, an instance profile and role will be created with minimal permissions needed to build the image, attached to the EC2 instance.

If an S3 logging bucket and key prefix is provided, an IAM inline policy will be attached to the instance profile's role, allowing s3:PutObject permissions on the bucket.

instanceTypesoptionalInstanceType[]instance_typesoptionaltyping.List[InstanceType]instanceTypesoptionalList<InstanceType>InstanceTypesoptionalInstanceType[]InstanceTypesoptional*[]InstanceType#
The instance types to launch build and test EC2 instances with.

Default: Image Builder will choose from a default set of instance types compatible with the AMI

keyPairoptionalIKeyPairkey_pairoptionalIKeyPairkeyPairoptionalIKeyPairKeyPairoptionalIKeyPairKeyPairoptionalIKeyPair= None#
The key pair used to connect to the build and test EC2 instances.

The key pair can be used to log into the build or test instances for troubleshooting any failures.

The log settings for detailed build logging.
notificationTopicoptionalITopicnotification_topicoptionalITopicnotificationTopicoptionalITopicNotificationTopicoptionalITopicNotificationTopicoptionalITopic#
The SNS topic on which notifications are sent when an image build completes.

Default: No notifications are sent

resourceTagsoptional{ [key: string]: string }resource_tagsoptionaltyping.Mapping[str, str]resourceTagsoptionalMap<String, String>ResourceTagsoptionalIDictionary<string, string>ResourceTagsoptional*map[string]*string= None#
The additional tags to assign to the Amazon EC2 instance that Image Builder launches during the build process.
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
An IAM role to associate with the instance profile used by Image Builder.

Default: A role will automatically be created, it can be accessed via the role property

The role must be assumable by the service principal ec2.amazonaws.com: Note: You can provide an instanceProfile or a role, but not both.

example
ts
const instanceProfileRole = new iam.Role(this, 'MyRole', {
  assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com')
});
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#
The security groups to associate with the instance used to customize the AMI.

Default: The default security group for the VPC will be used

subnetSelectionoptionalSubnetSelectionsubnet_selectionoptionalSubnetSelectionsubnetSelectionoptionalSubnetSelectionSubnetSelectionoptionalSubnetSelectionSubnetSelectionoptionalSubnetSelection#
Select which subnet to place the instance used to customize the AMI.

Default: The first subnet selected from the provided VPC will be used

The first subnet that is selected will be used. You must specify the VPC to customize the subnet selection.

tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[string]*string= None#
The tags to apply to the infrastructure configuration.
terminateInstanceOnFailureoptionalbooleanterminate_instance_on_failureoptionalboolterminateInstanceOnFailureoptionalBooleanTerminateInstanceOnFailureoptionalboolTerminateInstanceOnFailureoptional*bool= true#
Whether to terminate the EC2 instance when the build or test workflow fails.
vpcoptionalIVpcvpcoptionalIVpcvpcoptionalIVpcVpcoptionalIVpcVpcoptionalIVpc#
The VPC to place the instance used to customize the AMI.

Default: The default VPC will be used