Class InstanceProfile.Builder

java.lang.Object
software.amazon.awscdk.services.iam.InstanceProfile.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<InstanceProfile>
Enclosing class:
InstanceProfile

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

    • create

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

      @Stability(Stable) public InstanceProfile.Builder instanceProfileName(String instanceProfileName)
      The name of the InstanceProfile to create.

      Default: - generated by CloudFormation

      Parameters:
      instanceProfileName - The name of the InstanceProfile to create. This parameter is required.
      Returns:
      this
    • path

      @Stability(Stable) public InstanceProfile.Builder path(String path)
      The path to the InstanceProfile.

      Default: /

      Parameters:
      path - The path to the InstanceProfile. This parameter is required.
      Returns:
      this
    • role

      @Stability(Stable) public InstanceProfile.Builder role(IRole role)
      An IAM role to associate with the instance profile that is used by EC2 instances.

      The role must be assumable by the service principal ec2.amazonaws.com:

      Default: - a role will be automatically 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 that is used by EC2 instances. This parameter is required.
      Returns:
      this
    • build

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