InfrastructureConfigurationProps Struct
Properties for creating an Infrastructure Configuration resource.
Example
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
ec2InstanceAvailabilityZonestringec2_instance_availability_zonestrec2InstanceAvailabilityZoneStringEc2InstanceAvailabilityZonestringEc2InstanceAvailabilityZone*string= EC2 will select a random zone#ec2InstanceHostIdstringec2_instance_host_idstrec2InstanceHostIdStringEc2InstanceHostIdstringEc2InstanceHostId*string= None#This only applies if the instance tenancy is host. This cannot be used with the ec2InstanceHostResourceGroupArn parameter.
ec2InstanceHostResourceGroupArnstringec2_instance_host_resource_group_arnstrec2InstanceHostResourceGroupArnStringEc2InstanceHostResourceGroupArnstringEc2InstanceHostResourceGroupArn*string= None#This only applies if the instance tenancy is host. This cannot be used with the ec2InstanceHostId parameter.
ec2InstanceTenancyTenancyec2_instance_tenancyTenancyec2InstanceTenancyTenancyEc2InstanceTenancyTenancyEc2InstanceTenancyTenancy= Tenancy.DEFAULT#Dedicated tenancy runs instances on single-tenant hardware, while host tenancy runs instances on a dedicated host. Shared tenancy is used by default.
httpPutResponseHopLimitnumberhttp_put_response_hop_limitint | floathttpPutResponseHopLimitNumberHttpPutResponseHopLimitdoubleHttpPutResponseHopLimit*float64= 2#By default, this is set to 2.
httpTokensHttpTokenshttp_tokensHttpTokenshttpTokensHttpTokensHttpTokensHttpTokensHttpTokensHttpTokens= HttpTokens.REQUIRED#By default, this is set to required to require IMDSv2 on build and test EC2 instances.
infrastructureConfigurationNamestringinfrastructure_configuration_namestrinfrastructureConfigurationNameStringInfrastructureConfigurationNamestringInfrastructureConfigurationName*string= A name is generated#This name must be normalized by transforming all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
instanceProfileIInstanceProfileinstance_profileIInstanceProfileinstanceProfileIInstanceProfileInstanceProfileIInstanceProfileInstanceProfileIInstanceProfile= An instance profile will be gene…#notes · default
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.
Default: An instance profile will be generated
instanceTypesInstanceType[]instance_typestyping.List[InstanceType]instanceTypesList<InstanceType>InstanceTypesInstanceType[]InstanceTypes*[]InstanceType= Image Builder will choose from a…#default
Default: Image Builder will choose from a default set of instance types compatible with the AMI
The key pair can be used to log into the build or test instances for troubleshooting any failures.
loggingInfrastructureConfigurationLoggingloggingInfrastructureConfigurationLoggingloggingInfrastructureConfigurationLoggingLoggingInfrastructureConfigurationLoggingLoggingInfrastructureConfigurationLogging= None#notificationTopicITopicnotification_topicITopicnotificationTopicITopicNotificationTopicITopicNotificationTopicITopic= No notifications are sent#resourceTags{ [key: string]: string }resource_tagstyping.Mapping[str, str]resourceTagsMap<String, String>ResourceTagsIDictionary<string, string>ResourceTags*map[string]*string= None#The role must be assumable by the service principal ec2.amazonaws.com: Note: You can provide an instanceProfile or a role, but not both.
default · example
Default: A role will automatically be created, it can be accessed via the role property
const instanceProfileRole = new iam.Role(this, 'MyRole', {
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com')
});
securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= The default security group for t…#default
Default: The default security group for the VPC will be used
subnetSelectionSubnetSelectionsubnet_selectionSubnetSelectionsubnetSelectionSubnetSelectionSubnetSelectionSubnetSelectionSubnetSelectionSubnetSelection= The first subnet selected from t…#The first subnet that is selected will be used. You must specify the VPC to customize the subnet selection.
default
Default: The first subnet selected from the provided VPC will be used
tags{ [key: string]: string }tagstyping.Mapping[str, str]tagsMap<String, String>TagsIDictionary<string, string>Tags*map[string]*string= None#terminateInstanceOnFailurebooleanterminate_instance_on_failureboolterminateInstanceOnFailureBooleanTerminateInstanceOnFailureboolTerminateInstanceOnFailure*bool= true#