Class InfrastructureConfiguration.Builder

java.lang.Object
software.amazon.awscdk.services.imagebuilder.alpha.InfrastructureConfiguration.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<InfrastructureConfiguration>
Enclosing class:
InfrastructureConfiguration

@Stability(Experimental) public static final class InfrastructureConfiguration.Builder extends Object implements software.amazon.jsii.Builder<InfrastructureConfiguration>
(experimental) A fluent builder for InfrastructureConfiguration.
  • Method Details

    • create

      @Stability(Experimental) public static InfrastructureConfiguration.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of InfrastructureConfiguration.Builder.
    • description

      @Stability(Experimental) public InfrastructureConfiguration.Builder description(String description)
      (experimental) The description of the infrastructure configuration.

      Default: None

      Parameters:
      description - The description of the infrastructure configuration. This parameter is required.
      Returns:
      this
    • ec2InstanceAvailabilityZone

      @Stability(Experimental) public InfrastructureConfiguration.Builder ec2InstanceAvailabilityZone(String ec2InstanceAvailabilityZone)
      (experimental) The availability zone to place Image Builder build and test EC2 instances.

      Default: EC2 will select a random zone

      Parameters:
      ec2InstanceAvailabilityZone - The availability zone to place Image Builder build and test EC2 instances. This parameter is required.
      Returns:
      this
    • ec2InstanceHostId

      @Stability(Experimental) public InfrastructureConfiguration.Builder ec2InstanceHostId(String ec2InstanceHostId)
      (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

      Parameters:
      ec2InstanceHostId - The ID of the Dedicated Host on which build and test instances run. This parameter is required.
      Returns:
      this
    • ec2InstanceHostResourceGroupArn

      @Stability(Experimental) public InfrastructureConfiguration.Builder ec2InstanceHostResourceGroupArn(String ec2InstanceHostResourceGroupArn)
      (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

      Parameters:
      ec2InstanceHostResourceGroupArn - The ARN of the host resource group on which build and test instances run. This parameter is required.
      Returns:
      this
    • ec2InstanceTenancy

      @Stability(Experimental) public InfrastructureConfiguration.Builder ec2InstanceTenancy(Tenancy ec2InstanceTenancy)
      (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

      Parameters:
      ec2InstanceTenancy - The tenancy of the instance. This parameter is required.
      Returns:
      this
    • httpPutResponseHopLimit

      @Stability(Experimental) public InfrastructureConfiguration.Builder httpPutResponseHopLimit(Number httpPutResponseHopLimit)
      (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

      Parameters:
      httpPutResponseHopLimit - The maximum number of hops that an instance metadata request can traverse to reach its destination. This parameter is required.
      Returns:
      this
    • httpTokens

      @Stability(Experimental) public InfrastructureConfiguration.Builder httpTokens(HttpTokens httpTokens)
      (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

      Parameters:
      httpTokens - Indicates whether a signed token header is required for instance metadata retrieval requests. This parameter is required.
      Returns:
      this
    • infrastructureConfigurationName

      @Stability(Experimental) public InfrastructureConfiguration.Builder infrastructureConfigurationName(String infrastructureConfigurationName)
      (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

      Parameters:
      infrastructureConfigurationName - The name of the infrastructure configuration. This parameter is required.
      Returns:
      this
    • instanceProfile

      @Stability(Experimental) public InfrastructureConfiguration.Builder instanceProfile(IInstanceProfile instanceProfile)
      (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

      Parameters:
      instanceProfile - The instance profile to associate with the instance used to customize the AMI. This parameter is required.
      Returns:
      this
    • instanceTypes

      @Stability(Experimental) public InfrastructureConfiguration.Builder instanceTypes(List<? extends InstanceType> instanceTypes)
      (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

      Parameters:
      instanceTypes - The instance types to launch build and test EC2 instances with. This parameter is required.
      Returns:
      this
    • keyPair

      @Stability(Experimental) public InfrastructureConfiguration.Builder keyPair(IKeyPair keyPair)
      (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

      Parameters:
      keyPair - The key pair used to connect to the build and test EC2 instances. This parameter is required.
      Returns:
      this
    • logging

      @Stability(Experimental) public InfrastructureConfiguration.Builder logging(InfrastructureConfigurationLogging logging)
      (experimental) The log settings for detailed build logging.

      Default: None

      Parameters:
      logging - The log settings for detailed build logging. This parameter is required.
      Returns:
      this
    • notificationTopic

      @Stability(Experimental) public InfrastructureConfiguration.Builder notificationTopic(ITopic notificationTopic)
      (experimental) The SNS topic on which notifications are sent when an image build completes.

      Default: No notifications are sent

      Parameters:
      notificationTopic - The SNS topic on which notifications are sent when an image build completes. This parameter is required.
      Returns:
      this
    • resourceTags

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

      Default: None

      Parameters:
      resourceTags - The additional tags to assign to the Amazon EC2 instance that Image Builder launches during the build process. This parameter is required.
      Returns:
      this
    • role

      @Stability(Experimental) public InfrastructureConfiguration.Builder role(IRole role)
      (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();
       

      Parameters:
      role - An IAM role to associate with the instance profile used by Image Builder. This parameter is required.
      Returns:
      this
    • securityGroups

      @Stability(Experimental) public InfrastructureConfiguration.Builder securityGroups(List<? extends ISecurityGroup> securityGroups)
      (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

      Parameters:
      securityGroups - The security groups to associate with the instance used to customize the AMI. This parameter is required.
      Returns:
      this
    • subnetSelection

      @Stability(Experimental) public InfrastructureConfiguration.Builder subnetSelection(SubnetSelection subnetSelection)
      (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

      Parameters:
      subnetSelection - Select which subnet to place the instance used to customize the AMI. This parameter is required.
      Returns:
      this
    • tags

      @Stability(Experimental) public InfrastructureConfiguration.Builder tags(Map<String,String> tags)
      (experimental) The tags to apply to the infrastructure configuration.

      Default: None

      Parameters:
      tags - The tags to apply to the infrastructure configuration. This parameter is required.
      Returns:
      this
    • terminateInstanceOnFailure

      @Stability(Experimental) public InfrastructureConfiguration.Builder terminateInstanceOnFailure(Boolean terminateInstanceOnFailure)
      (experimental) Whether to terminate the EC2 instance when the build or test workflow fails.

      Default: true

      Parameters:
      terminateInstanceOnFailure - Whether to terminate the EC2 instance when the build or test workflow fails. This parameter is required.
      Returns:
      this
    • vpc

      @Stability(Experimental) public InfrastructureConfiguration.Builder vpc(IVpc vpc)
      (experimental) The VPC to place the instance used to customize the AMI.

      Default: The default VPC will be used

      Parameters:
      vpc - The VPC to place the instance used to customize the AMI. This parameter is required.
      Returns:
      this
    • build

      @Stability(Experimental) public InfrastructureConfiguration build()
      Specified by:
      build in interface software.amazon.jsii.Builder<InfrastructureConfiguration>
      Returns:
      a newly built instance of InfrastructureConfiguration.