You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::IAM::InstanceProfile

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(name, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(name, options = {}) ⇒ Object

    Parameters:

    • name (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :name (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#arnString (readonly)

The Amazon Resource Name (ARN) specifying the instance profile. For more information about ARNs and how to use them in policies, see IAM Identifiers in the IAM User Guide.

Returns:

  • (String)

    The Amazon Resource Name (ARN) specifying the instance profile.

#create_dateTime (readonly)

The date when the instance profile was created.

Returns:

  • (Time)

    The date when the instance profile was created.

#instance_profile_idString (readonly)

The stable and unique string identifying the instance profile. For more information about IDs, see IAM Identifiers in the IAM User Guide.

Returns:

  • (String)

    The stable and unique string identifying the instance profile.

#instance_profile_nameString (readonly)

The name identifying the instance profile.

Returns:

  • (String)

    The name identifying the instance profile.

#nameString (readonly)

Returns:

  • (String)

#pathString (readonly)

The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.

Returns:

  • (String)

    The path to the instance profile.

Instance Method Details

#add_role(options = {}) ⇒ Struct

Adds the specified IAM role to the specified instance profile. An instance profile can contain only one role. (The number and size of IAM resources in an AWS account are limited. For more information, see IAM and STS Quotas in the IAM User Guide.) You can remove the existing role and then add a different role to an instance profile. You must then wait for the change to appear across all of AWS because of eventual consistency. To force the change, you must disassociate the instance profile and then associate the instance profile, or you can stop your instance and then restart it.

The caller of this API must be granted the PassRole permission on the IAM role by a permissions policy.

For more information about roles, go to Working with Roles. For more information about instance profiles, go to About Instance Profiles.

Examples:

Request syntax example with placeholder values


instanceprofile.add_role({
  role_name: "roleNameType", # required
})

Options Hash (options):

  • :role_name (required, String)

    The name of the role to add.

    This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#deleteStruct

Deletes the specified instance profile. The instance profile must not have an associated role.

Make sure that you do not have any Amazon EC2 instances running with the instance profile you are about to delete. Deleting a role or instance profile that is associated with a running instance will break any applications running on the instance.

For more information about instance profiles, go to About Instance Profiles.

Examples:

Request syntax example with placeholder values


instanceprofile.delete()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#exists?Boolean

Returns true if this InstanceProfile exists. Returns false otherwise.

Returns:

  • (Boolean)

    Returns true if this InstanceProfile exists. Returns false otherwise.

#remove_role(options = {}) ⇒ Struct

Removes the specified IAM role from the specified EC2 instance profile.

Make sure that you do not have any Amazon EC2 instances running with the role you are about to remove from the instance profile. Removing a role from an instance profile that is associated with a running instance might break any applications running on the instance.

For more information about IAM roles, go to Working with Roles. For more information about instance profiles, go to About Instance Profiles.

Examples:

Request syntax example with placeholder values


instanceprofile.remove_role({
  role_name: "roleNameType", # required
})

Options Hash (options):

  • :role_name (required, String)

    The name of the role to remove.

    This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#rolesArray<Role>?

Returns:

  • (Array<Role>, nil)

#wait_until_exists {|waiter| ... } ⇒ InstanceProfile

Waits until this InstanceProfile is exists. This method waits by polling Client#get_instance_profile until successful. An error is raised after a configurable number of failed checks.

This waiter uses the following defaults:

Configuration Default
#delay 1
#max_attempts 40

You can modify defaults and register callbacks by passing a block argument.

Examples:

Basic usage

instanceprofile.wait_until_exists

Yield Parameters:

Returns:

  • (InstanceProfile)

    Returns a copy of this InstanceProfile that is not loaded.

Raises:

See Also: