Class InfrastructureConfiguration

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.imagebuilder.alpha.InfrastructureConfiguration
All Implemented Interfaces:
IEnvironmentAware, IResource, IInfrastructureConfiguration, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)", date="2025-11-13T16:10:18.394Z") @Stability(Experimental) public class InfrastructureConfiguration extends Resource implements IInfrastructureConfiguration
(experimental) Represents an EC2 Image Builder Infrastructure Configuration.

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();
 

See Also:
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Experimental) public static final String PROPERTY_INJECTION_ID
      (experimental) Uniquely identifies this class.
  • Constructor Details

    • InfrastructureConfiguration

      protected InfrastructureConfiguration(software.amazon.jsii.JsiiObjectRef objRef)
    • InfrastructureConfiguration

      protected InfrastructureConfiguration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • InfrastructureConfiguration

      @Stability(Experimental) public InfrastructureConfiguration(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable InfrastructureConfigurationProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • InfrastructureConfiguration

      @Stability(Experimental) public InfrastructureConfiguration(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromInfrastructureConfigurationArn

      @Stability(Experimental) @NotNull public static IInfrastructureConfiguration fromInfrastructureConfigurationArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String infrastructureConfigurationArn)
      (experimental) Import an existing infrastructure configuration given its ARN.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      infrastructureConfigurationArn - This parameter is required.
    • fromInfrastructureConfigurationName

      @Stability(Experimental) @NotNull public static IInfrastructureConfiguration fromInfrastructureConfigurationName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String infrastructureConfigurationName)
      (experimental) Import an existing infrastructure configuration given its name.

      The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      infrastructureConfigurationName - This parameter is required.
    • isInfrastructureConfiguration

      @Stability(Experimental) @NotNull public static Boolean isInfrastructureConfiguration(@NotNull Object x)
      (experimental) Return whether the given object is an InfrastructureConfiguration.

      Parameters:
      x - This parameter is required.
    • grant

      @Stability(Experimental) @NotNull public Grant grant(@NotNull IGrantable grantee, @NotNull String... actions)
      (experimental) Grant custom actions to the given grantee for the infrastructure configuration.

      Specified by:
      grant in interface IInfrastructureConfiguration
      Parameters:
      grantee -
      • The principal.
      This parameter is required.
      actions -
      • The list of actions.
      This parameter is required.
    • grantRead

      @Stability(Experimental) @NotNull public Grant grantRead(@NotNull IGrantable grantee)
      (experimental) Grant read permissions to the given grantee for the infrastructure configuration.

      Specified by:
      grantRead in interface IInfrastructureConfiguration
      Parameters:
      grantee -
      • The principal.
      This parameter is required.
    • getInfrastructureConfigurationArn

      @Stability(Experimental) @NotNull public String getInfrastructureConfigurationArn()
      (experimental) The ARN of the infrastructure configuration.
      Specified by:
      getInfrastructureConfigurationArn in interface IInfrastructureConfiguration
    • getInfrastructureConfigurationName

      @Stability(Experimental) @NotNull public String getInfrastructureConfigurationName()
      (experimental) The name of the infrastructure configuration.
      Specified by:
      getInfrastructureConfigurationName in interface IInfrastructureConfiguration
    • getInstanceProfile

      @Stability(Experimental) @NotNull public IInstanceProfile getInstanceProfile()
      (experimental) The EC2 instance profile to use for the build.
    • getLogBucket

      @Stability(Experimental) @Nullable public IBucket getLogBucket()
      (experimental) The bucket used to upload image build logs.
    • getRole

      @Stability(Experimental) @Nullable public IRole getRole()
      (experimental) The role associated with the EC2 instance profile used for the build.