Interface InfrastructureConfigurationProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
InfrastructureConfigurationProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)", date="2025-11-13T16:10:18.396Z") @Stability(Experimental) public interface InfrastructureConfigurationProps extends software.amazon.jsii.JsiiSerializable
(experimental) Properties for creating an Infrastructure Configuration resource.

Example:

 InfrastructureConfiguration infrastructureConfiguration = InfrastructureConfiguration.Builder.create(this, "InfrastructureConfiguration")
         .infrastructureConfigurationName("test-infrastructure-configuration")
         .description("An Infrastructure Configuration")
         // Optional - instance types to use for build/test
         .instanceTypes(List.of(InstanceType.of(InstanceClass.STANDARD7_INTEL, InstanceSize.LARGE), InstanceType.of(InstanceClass.BURSTABLE3, InstanceSize.LARGE)))
         // Optional - create an instance profile with necessary permissions
         .instanceProfile(InstanceProfile.Builder.create(this, "InstanceProfile")
                 .instanceProfileName("test-instance-profile")
                 .role(Role.Builder.create(this, "InstanceProfileRole")
                         .assumedBy(ServicePrincipal.fromStaticServicePrincipleName("ec2.amazonaws.com"))
                         .managedPolicies(List.of(ManagedPolicy.fromAwsManagedPolicyName("AmazonSSMManagedInstanceCore"), ManagedPolicy.fromAwsManagedPolicyName("EC2InstanceProfileForImageBuilder")))
                         .build())
                 .build())
         // Use VPC network configuration
         .vpc(vpc)
         .subnetSelection(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build())
         .securityGroups(List.of(SecurityGroup.fromSecurityGroupId(this, "SecurityGroup", vpc.getVpcDefaultSecurityGroup())))
         .keyPair(KeyPair.fromKeyPairName(this, "KeyPair", "imagebuilder-instance-key-pair"))
         .terminateInstanceOnFailure(true)
         // Optional - IMDSv2 settings
         .httpTokens(HttpTokens.REQUIRED)
         .httpPutResponseHopLimit(1)
         // Optional - publish image completion messages to an SNS topic
         .notificationTopic(Topic.fromTopicArn(this, "Topic", this.formatArn(ArnComponents.builder().service("sns").resource("image-builder-topic").build())))
         // Optional - log settings. Logging is enabled by default
         .logging(InfrastructureConfigurationLogging.builder()
                 .s3Bucket(Bucket.fromBucketName(this, "LogBucket", String.format("imagebuilder-logging-%s", Aws.ACCOUNT_ID)))
                 .s3KeyPrefix("imagebuilder-logs")
                 .build())
         // Optional - host placement settings
         .ec2InstanceAvailabilityZone(Stack.of(this).getAvailabilityZones()[0])
         .ec2InstanceHostId(dedicatedHost.getAttrHostId())
         .ec2InstanceTenancy(Tenancy.HOST)
         .resourceTags(Map.of(
                 "Environment", "production"))
         .build();
 
  • Method Details

    • getDescription

      @Stability(Experimental) @Nullable default String getDescription()
      (experimental) The description of the infrastructure configuration.

      Default: None

    • getEc2InstanceAvailabilityZone

      @Stability(Experimental) @Nullable default String getEc2InstanceAvailabilityZone()
      (experimental) The availability zone to place Image Builder build and test EC2 instances.

      Default: EC2 will select a random zone

    • getEc2InstanceHostId

      @Stability(Experimental) @Nullable default String getEc2InstanceHostId()
      (experimental) 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.

      Default: None

    • getEc2InstanceHostResourceGroupArn

      @Stability(Experimental) @Nullable default String getEc2InstanceHostResourceGroupArn()
      (experimental) 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.

      Default: None

    • getEc2InstanceTenancy

      @Stability(Experimental) @Nullable default Tenancy getEc2InstanceTenancy()
      (experimental) 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.

      Default: Tenancy.DEFAULT

    • getHttpPutResponseHopLimit

      @Stability(Experimental) @Nullable default Number getHttpPutResponseHopLimit()
      (experimental) The maximum number of hops that an instance metadata request can traverse to reach its destination.

      By default, this is set to 2.

      Default: 2

    • getHttpTokens

      @Stability(Experimental) @Nullable default HttpTokens getHttpTokens()
      (experimental) 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.

      Default: HttpTokens.REQUIRED

    • getInfrastructureConfigurationName

      @Stability(Experimental) @Nullable default String getInfrastructureConfigurationName()
      (experimental) The name of the infrastructure configuration.

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

      Default: A name is generated

    • getInstanceProfile

      @Stability(Experimental) @Nullable default IInstanceProfile getInstanceProfile()
      (experimental) The instance profile to associate with the instance used to customize the AMI.

      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

    • getInstanceTypes

      @Stability(Experimental) @Nullable default List<InstanceType> getInstanceTypes()
      (experimental) 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

    • getKeyPair

      @Stability(Experimental) @Nullable default IKeyPair getKeyPair()
      (experimental) 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.

      Default: None

    • getLogging

      @Stability(Experimental) @Nullable default InfrastructureConfigurationLogging getLogging()
      (experimental) The log settings for detailed build logging.

      Default: None

    • getNotificationTopic

      @Stability(Experimental) @Nullable default ITopic getNotificationTopic()
      (experimental) The SNS topic on which notifications are sent when an image build completes.

      Default: No notifications are sent

    • getResourceTags

      @Stability(Experimental) @Nullable default Map<String,String> getResourceTags()
      (experimental) The additional tags to assign to the Amazon EC2 instance that Image Builder launches during the build process.

      Default: None

    • getRole

      @Stability(Experimental) @Nullable default IRole getRole()
      (experimental) An IAM role to associate with the instance profile used by Image Builder.

      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: A role will automatically be created, it can be accessed via the `role` property

      Example:

       Role role = Role.Builder.create(this, "MyRole")
               .assumedBy(new ServicePrincipal("ec2.amazonaws.com"))
               .build();
       
    • getSecurityGroups

      @Stability(Experimental) @Nullable default List<ISecurityGroup> getSecurityGroups()
      (experimental) The security groups to associate with the instance used to customize the AMI.

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

    • getSubnetSelection

      @Stability(Experimental) @Nullable default SubnetSelection getSubnetSelection()
      (experimental) Select which subnet to place the instance used to customize the AMI.

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

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

    • getTags

      @Stability(Experimental) @Nullable default Map<String,String> getTags()
      (experimental) The tags to apply to the infrastructure configuration.

      Default: None

    • getTerminateInstanceOnFailure

      @Stability(Experimental) @Nullable default Boolean getTerminateInstanceOnFailure()
      (experimental) Whether to terminate the EC2 instance when the build or test workflow fails.

      Default: true

    • getVpc

      @Stability(Experimental) @Nullable default IVpc getVpc()
      (experimental) The VPC to place the instance used to customize the AMI.

      Default: The default VPC will be used

    • builder

      @Stability(Experimental) static InfrastructureConfigurationProps.Builder builder()
      Returns:
      a InfrastructureConfigurationProps.Builder of InfrastructureConfigurationProps