Class InstanceProfile

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.iam.InstanceProfile
All Implemented Interfaces:
IInstanceProfileRef, IEnvironmentAware, IResource, IInstanceProfile, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)", date="2025-12-05T22:26:37.914Z") @Stability(Stable) public class InstanceProfile extends Resource implements IInstanceProfile
IAM Instance Profile.

Example:

 Vpc vpc;
 Role role = Role.Builder.create(this, "Role")
         .assumedBy(new ServicePrincipal("ec2.amazonaws.com"))
         .build();
 InstanceProfile instanceProfile = InstanceProfile.Builder.create(this, "InstanceProfile")
         .role(role)
         .build();
 LaunchTemplate template = LaunchTemplate.Builder.create(this, "LaunchTemplate")
         .launchTemplateName("MyTemplateV1")
         .versionDescription("This is my v1 template")
         .machineImage(MachineImage.latestAmazonLinux2023())
         .securityGroup(SecurityGroup.Builder.create(this, "LaunchTemplateSG")
                 .vpc(vpc)
                 .build())
         .instanceProfile(instanceProfile)
         .build();
 
  • Field Details

    • PROPERTY_INJECTION_ID

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

    • InstanceProfile

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

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

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

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

    • fromInstanceProfileArn

      @Stability(Stable) @NotNull public static IInstanceProfile fromInstanceProfileArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String instanceProfileArn)
      Import an existing InstanceProfile from an InstanceProfile ARN.

      If the ARN comes from a Token, the InstanceProfile cannot have a path; if so, any attempt to reference its instanceProfileName will fail.

      Parameters:
      scope - construct scope. This parameter is required.
      id - construct id. This parameter is required.
      instanceProfileArn - the ARN of the exiting InstanceProfile to import. This parameter is required.
    • fromInstanceProfileAttributes

      @Stability(Stable) @NotNull public static IInstanceProfile fromInstanceProfileAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull InstanceProfileAttributes attrs)
      Import an existing InstanceProfile from given InstanceProfile attributes.

      If the ARN comes from a Token, the InstanceProfile cannot have a path; if so, any attempt to reference its instanceProfileName will fail.

      Parameters:
      scope - construct scope. This parameter is required.
      id - construct id. This parameter is required.
      attrs - the attributes of the InstanceProfile to import. This parameter is required.
    • fromInstanceProfileName

      @Stability(Stable) @NotNull public static IInstanceProfile fromInstanceProfileName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String instanceProfileName)
      Import an existing InstanceProfile from an InstanceProfile name.

      Parameters:
      scope - construct scope. This parameter is required.
      id - construct id. This parameter is required.
      instanceProfileName - the name of the existing InstanceProfile to import. This parameter is required.
    • getInstanceProfileArn

      @Stability(Stable) @NotNull public String getInstanceProfileArn()
      Returns the ARN of this InstanceProfile.
      Specified by:
      getInstanceProfileArn in interface IInstanceProfile
    • getInstanceProfileName

      @Stability(Stable) @NotNull public String getInstanceProfileName()
      Returns the name of this InstanceProfile.
      Specified by:
      getInstanceProfileName in interface IInstanceProfile
    • getInstanceProfileRef

      @Stability(Stable) @NotNull public InstanceProfileReference getInstanceProfileRef()
      A reference to a InstanceProfile resource.
      Specified by:
      getInstanceProfileRef in interface IInstanceProfileRef
    • getRole

      @Stability(Stable) @Nullable public IRole getRole()
      Returns the role associated with this InstanceProfile.
      Specified by:
      getRole in interface IInstanceProfile