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:
IResource, IInstanceProfile, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:08.163Z") @Stability(Stable) public class InstanceProfile extends Resource implements IInstanceProfile
IAM Instance Profile.

Example:

 Role role = Role.Builder.create(this, "Role")
         .assumedBy(new ServicePrincipal("ec2.amazonaws.com"))
         .build();
 IInstanceProfile instanceProfile = InstanceProfile.fromInstanceProfileAttributes(this, "ImportedInstanceProfile", InstanceProfileAttributes.builder()
         .instanceProfileArn("arn:aws:iam::account-id:instance-profile/MyInstanceProfile")
         .role(role)
         .build());
 
  • 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
    • getRole

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