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

Class: Aws::IAM::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



142
143
144
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 142

def initialize(*args)
  super
end

Instance Method Details

#add_client_id_to_open_id_connect_provider(params = {}) ⇒ Struct

Adds a new client ID (also known as audience) to the list of client IDs already registered for the specified IAM OpenID Connect (OIDC) provider resource.

This action is idempotent; it does not fail or return an error if you add an existing client ID to the provider.

Examples:

Example: To add a client ID (audience) to an Open-ID Connect (OIDC) provider


# The following add-client-id-to-open-id-connect-provider command adds the client ID my-application-ID to the OIDC provider named server.example.com:

resp = client.add_client_id_to_open_id_connect_provider({
  client_id: "my-application-ID", 
  open_id_connect_provider_arn: "arn:aws:iam::123456789012:oidc-provider/server.example.com", 
})

Request syntax with placeholder values


resp = client.add_client_id_to_open_id_connect_provider({
  open_id_connect_provider_arn: "arnType", # required
  client_id: "clientIDType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :open_id_connect_provider_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM OpenID Connect (OIDC) provider resource to add the client ID to. You can get a list of OIDC provider ARNs by using the ListOpenIDConnectProviders action.

  • :client_id (required, String)

    The client ID (also known as audience) to add to the IAM OpenID Connect provider resource.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



187
188
189
190
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 187

def add_client_id_to_open_id_connect_provider(params = {}, options = {})
  req = build_request(:add_client_id_to_open_id_connect_provider, params)
  req.send_request(options)
end

#add_role_to_instance_profile(params = {}) ⇒ Struct

Adds the specified IAM role to the specified instance profile. An instance profile can contain only one role, and this limit cannot be increased.

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

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

Examples:

Example: To add a role to an instance profile


# The following command adds the role named S3Access to the instance profile named Webserver:

resp = client.add_role_to_instance_profile({
  instance_profile_name: "Webserver", 
  role_name: "S3Access", 
})

Request syntax with placeholder values


resp = client.add_role_to_instance_profile({
  instance_profile_name: "instanceProfileNameType", # required
  role_name: "roleNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_profile_name (required, String)

    The name of the instance profile to update.

    This parameter allows (per 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: =,.@-

  • :role_name (required, String)

    The name of the role to add.

    This parameter allows (per 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:



257
258
259
260
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 257

def add_role_to_instance_profile(params = {}, options = {})
  req = build_request(:add_role_to_instance_profile, params)
  req.send_request(options)
end

#add_user_to_group(params = {}) ⇒ Struct

Adds the specified user to the specified group.

Examples:

Example: To add a user to an IAM group


# The following command adds an IAM user named Bob to the IAM group named Admins:

resp = client.add_user_to_group({
  group_name: "Admins", 
  user_name: "Bob", 
})

Request syntax with placeholder values


resp = client.add_user_to_group({
  group_name: "groupNameType", # required
  user_name: "existingUserNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group to update.

    This parameter allows (per 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: =,.@-

  • :user_name (required, String)

    The name of the user to add.

    This parameter allows (per 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:



311
312
313
314
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 311

def add_user_to_group(params = {}, options = {})
  req = build_request(:add_user_to_group, params)
  req.send_request(options)
end

#attach_group_policy(params = {}) ⇒ Struct

Attaches the specified managed policy to the specified IAM group.

You use this API to attach a managed policy to a group. To embed an inline policy in a group, use PutGroupPolicy.

For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Example: To attach a managed policy to an IAM group


# The following command attaches the AWS managed policy named ReadOnlyAccess to the IAM group named Finance.

resp = client.attach_group_policy({
  group_name: "Finance", 
  policy_arn: "arn:aws:iam::aws:policy/ReadOnlyAccess", 
})

Request syntax with placeholder values


resp = client.attach_group_policy({
  group_name: "groupNameType", # required
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name (friendly name, not ARN) of the group to attach the policy to.

    This parameter allows (per 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: =,.@-

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy you want to attach.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



374
375
376
377
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 374

def attach_group_policy(params = {}, options = {})
  req = build_request(:attach_group_policy, params)
  req.send_request(options)
end

#attach_role_policy(params = {}) ⇒ Struct

Attaches the specified managed policy to the specified IAM role. When you attach a managed policy to a role, the managed policy becomes part of the role's permission (access) policy.

You cannot use a managed policy as the role's trust policy. The role's trust policy is created at the same time as the role, using CreateRole. You can update a role's trust policy using UpdateAssumeRolePolicy.

Use this API to attach a managed policy to a role. To embed an inline policy in a role, use PutRolePolicy. For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Example: To attach a managed policy to an IAM role


# The following command attaches the AWS managed policy named ReadOnlyAccess to the IAM role named ReadOnlyRole.

resp = client.attach_role_policy({
  policy_arn: "arn:aws:iam::aws:policy/ReadOnlyAccess", 
  role_name: "ReadOnlyRole", 
})

Request syntax with placeholder values


resp = client.attach_role_policy({
  role_name: "roleNameType", # required
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name (friendly name, not ARN) of the role to attach the policy to.

    This parameter allows (per 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: _+=,.@-

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy you want to attach.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



444
445
446
447
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 444

def attach_role_policy(params = {}, options = {})
  req = build_request(:attach_role_policy, params)
  req.send_request(options)
end

#attach_user_policy(params = {}) ⇒ Struct

Attaches the specified managed policy to the specified user.

You use this API to attach a managed policy to a user. To embed an inline policy in a user, use PutUserPolicy.

For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Example: To attach a managed policy to an IAM user


# The following command attaches the AWS managed policy named AdministratorAccess to the IAM user named Alice.

resp = client.attach_user_policy({
  policy_arn: "arn:aws:iam::aws:policy/AdministratorAccess", 
  user_name: "Alice", 
})

Request syntax with placeholder values


resp = client.attach_user_policy({
  user_name: "userNameType", # required
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name (friendly name, not ARN) of the IAM user to attach the policy to.

    This parameter allows (per 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: =,.@-

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy you want to attach.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



507
508
509
510
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 507

def attach_user_policy(params = {}, options = {})
  req = build_request(:attach_user_policy, params)
  req.send_request(options)
end

#change_password(params = {}) ⇒ Struct

Changes the password of the IAM user who is calling this action. The root account password is not affected by this action.

To change the password for a different user, see UpdateLoginProfile. For more information about modifying passwords, see Managing Passwords in the IAM User Guide.

Examples:

Example: To change the password for your IAM user


# The following command changes the password for the current IAM user.

resp = client.change_password({
  new_password: "]35d/{pB9Fo9wJ", 
  old_password: "3s0K_;xh4~8XXI", 
})

Request syntax with placeholder values


resp = client.change_password({
  old_password: "passwordType", # required
  new_password: "passwordType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :old_password (required, String)

    The IAM user's current password.

  • :new_password (required, String)

    The new password. The new password must conform to the AWS account's password policy, if one exists.

    The regex pattern used to validate this parameter is a string of characters consisting of almost any printable ASCII character from the space (\u0020) through the end of the ASCII character range (\u00FF). You can also include the tab (\u0009), line feed (\u000A), and carriage return (\u000D) characters. Although any of these characters are valid in a password, note that many tools, such as the AWS Management Console, might restrict the ability to enter certain characters because they have special meaning within that tool.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



566
567
568
569
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 566

def change_password(params = {}, options = {})
  req = build_request(:change_password, params)
  req.send_request(options)
end

#create_access_key(params = {}) ⇒ Types::CreateAccessKeyResponse

Creates a new AWS secret access key and corresponding AWS access key ID for the specified user. The default status for new keys is Active.

If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID signing the request. Because this action works for access keys under the AWS account, you can use this action to manage root credentials even if the AWS account has no associated users.

For information about limits on the number of keys you can create, see Limitations on IAM Entities in the IAM User Guide.

To ensure the security of your AWS account, the secret access key is accessible only during key and user creation. You must save the key (for example, in a text file) if you want to be able to access it again. If a secret key is lost, you can delete the access keys for the associated user and then create new keys.

Examples:

Example: To create an access key for an IAM user


# The following command creates an access key (access key ID and secret access key) for the IAM user named Bob.

resp = client.create_access_key({
  user_name: "Bob", 
})

resp.to_h outputs the following:
{
  access_key: {
    access_key_id: "AKIAIOSFODNN7EXAMPLE", 
    create_date: Time.parse("2015-03-09T18:39:23.411Z"), 
    secret_access_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY", 
    status: "Active", 
    user_name: "Bob", 
  }, 
}

Request syntax with placeholder values


resp = client.create_access_key({
  user_name: "existingUserNameType",
})

Response structure


resp.access_key.user_name #=> String
resp.access_key.access_key_id #=> String
resp.access_key.status #=> String, one of "Active", "Inactive"
resp.access_key.secret_access_key #=> String
resp.access_key.create_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the IAM user that the new key will belong to.

    This parameter allows (per 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:

See Also:



648
649
650
651
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 648

def create_access_key(params = {}, options = {})
  req = build_request(:create_access_key, params)
  req.send_request(options)
end

#create_account_alias(params = {}) ⇒ Struct

Creates an alias for your AWS account. For information about using an AWS account alias, see Using an Alias for Your AWS Account ID in the IAM User Guide.

Examples:

Example: To create an account alias


# The following command associates the alias examplecorp to your AWS account.

resp = client.({
  account_alias: "examplecorp", 
})

Request syntax with placeholder values


resp = client.({
  account_alias: "accountAliasType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_alias (required, String)

    The account alias to create.

    This parameter allows (per its regex pattern) a string of characters consisting of lowercase letters, digits, and dashes. You cannot start or finish with a dash, nor can you have two dashes in a row.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



694
695
696
697
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 694

def (params = {}, options = {})
  req = build_request(:create_account_alias, params)
  req.send_request(options)
end

#create_group(params = {}) ⇒ Types::CreateGroupResponse

Creates a new group.

For information about the number of groups you can create, see Limitations on IAM Entities in the IAM User Guide.

Examples:

Example: To create an IAM group


# The following command creates an IAM group named Admins.

resp = client.create_group({
  group_name: "Admins", 
})

resp.to_h outputs the following:
{
  group: {
    arn: "arn:aws:iam::123456789012:group/Admins", 
    create_date: Time.parse("2015-03-09T20:30:24.940Z"), 
    group_id: "AIDGPMS9RO4H3FEXAMPLE", 
    group_name: "Admins", 
    path: "/", 
  }, 
}

Request syntax with placeholder values


resp = client.create_group({
  path: "pathType",
  group_name: "groupNameType", # required
})

Response structure


resp.group.path #=> String
resp.group.group_name #=> String
resp.group.group_id #=> String
resp.group.arn #=> String
resp.group.create_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path (String)

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

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :group_name (required, String)

    The name of the group to create. Do not include the path in this value.

    This parameter allows (per 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: =,.@-. The group name must be unique within the account. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".

Returns:

See Also:



785
786
787
788
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 785

def create_group(params = {}, options = {})
  req = build_request(:create_group, params)
  req.send_request(options)
end

#create_instance_profile(params = {}) ⇒ Types::CreateInstanceProfileResponse

Creates a new instance profile. For information about instance profiles, go to About Instance Profiles.

For information about the number of instance profiles you can create, see Limitations on IAM Entities in the IAM User Guide.

Examples:

Example: To create an instance profile


# The following command creates an instance profile named Webserver that is ready to have a role attached and then be associated with an EC2 instance.

resp = client.create_instance_profile({
  instance_profile_name: "Webserver", 
})

resp.to_h outputs the following:
{
  instance_profile: {
    arn: "arn:aws:iam::123456789012:instance-profile/Webserver", 
    create_date: Time.parse("2015-03-09T20:33:19.626Z"), 
    instance_profile_id: "AIPAJMBYC7DLSPEXAMPLE", 
    instance_profile_name: "Webserver", 
    path: "/", 
    roles: [
    ], 
  }, 
}

Request syntax with placeholder values


resp = client.create_instance_profile({
  instance_profile_name: "instanceProfileNameType", # required
  path: "pathType",
})

Response structure


resp.instance_profile.path #=> String
resp.instance_profile.instance_profile_name #=> String
resp.instance_profile.instance_profile_id #=> String
resp.instance_profile.arn #=> String
resp.instance_profile.create_date #=> Time
resp.instance_profile.roles #=> Array
resp.instance_profile.roles[0].path #=> String
resp.instance_profile.roles[0].role_name #=> String
resp.instance_profile.roles[0].role_id #=> String
resp.instance_profile.roles[0].arn #=> String
resp.instance_profile.roles[0].create_date #=> Time
resp.instance_profile.roles[0].assume_role_policy_document #=> String
resp.instance_profile.roles[0].description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_profile_name (required, String)

    The name of the instance profile to create.

    This parameter allows (per 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: =,.@-

  • :path (String)

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

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

Returns:

See Also:



885
886
887
888
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 885

def create_instance_profile(params = {}, options = {})
  req = build_request(:create_instance_profile, params)
  req.send_request(options)
end

#create_login_profile(params = {}) ⇒ Types::CreateLoginProfileResponse

Creates a password for the specified user, giving the user the ability to access AWS services through the AWS Management Console. For more information about managing passwords, see Managing Passwords in the IAM User Guide.

Examples:

Example: To create an instance profile


# The following command changes IAM user Bob's password and sets the flag that required Bob to change the password the next time he signs in.

resp = client.({
  password: "h]6EszR}vJ*m", 
  password_reset_required: true, 
  user_name: "Bob", 
})

resp.to_h outputs the following:
{
  login_profile: {
    create_date: Time.parse("2015-03-10T20:55:40.274Z"), 
    password_reset_required: true, 
    user_name: "Bob", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  user_name: "userNameType", # required
  password: "passwordType", # required
  password_reset_required: false,
})

Response structure


resp..user_name #=> String
resp..create_date #=> Time
resp..password_reset_required #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the IAM user to create a password for. The user must already exist.

    This parameter allows (per 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: =,.@-

  • :password (required, String)

    The new password for the user.

    The regex pattern used to validate this parameter is a string of characters consisting of almost any printable ASCII character from the space (\u0020) through the end of the ASCII character range (\u00FF). You can also include the tab (\u0009), line feed (\u000A), and carriage return (\u000D) characters. Although any of these characters are valid in a password, note that many tools, such as the AWS Management Console, might restrict the ability to enter certain characters because they have special meaning within that tool.

  • :password_reset_required (Boolean)

    Specifies whether the user is required to set a new password on next sign-in.

Returns:

See Also:



974
975
976
977
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 974

def (params = {}, options = {})
  req = build_request(:create_login_profile, params)
  req.send_request(options)
end

#create_open_id_connect_provider(params = {}) ⇒ Types::CreateOpenIDConnectProviderResponse

Creates an IAM entity to describe an identity provider (IdP) that supports OpenID Connect (OIDC).

The OIDC provider that you create with this operation can be used as a principal in a role's trust policy to establish a trust relationship between AWS and the OIDC provider.

When you create the IAM OIDC provider, you specify the URL of the OIDC identity provider (IdP) to trust, a list of client IDs (also known as audiences) that identify the application or applications that are allowed to authenticate using the OIDC provider, and a list of thumbprints of the server certificate(s) that the IdP uses. You get all of this information from the OIDC IdP that you want to use for access to AWS.

Because trust for the OIDC provider is ultimately derived from the IAM provider that this action creates, it is a best practice to limit access to the CreateOpenIDConnectProvider action to highly-privileged users.

Examples:

Example: To create an instance profile


# The following example defines a new OIDC provider in IAM with a client ID of my-application-id and pointing at the server with a URL of https://server.example.com.

resp = client.create_open_id_connect_provider({
  client_id_list: [
    "my-application-id", 
  ], 
  thumbprint_list: [
    "3768084dfb3d2b68b7897bf5f565da8efEXAMPLE", 
  ], 
  url: "https://server.example.com", 
})

resp.to_h outputs the following:
{
  open_id_connect_provider_arn: "arn:aws:iam::123456789012:oidc-provider/server.example.com", 
}

Request syntax with placeholder values


resp = client.create_open_id_connect_provider({
  url: "OpenIDConnectProviderUrlType", # required
  client_id_list: ["clientIDType"],
  thumbprint_list: ["thumbprintType"], # required
})

Response structure


resp.open_id_connect_provider_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :url (required, String)

    The URL of the identity provider. The URL must begin with "https://" and should correspond to the iss claim in the provider's OpenID Connect ID tokens. Per the OIDC standard, path components are allowed but query parameters are not. Typically the URL consists of only a host name, like "https://server.example.org" or "https://example.com".

    You cannot register the same provider multiple times in a single AWS account. If you try to submit a URL that has already been used for an OpenID Connect provider in the AWS account, you will get an error.

  • :client_id_list (Array<String>)

    A list of client IDs (also known as audiences). When a mobile or web app registers with an OpenID Connect provider, they establish a value that identifies the application. (This is the value that's sent as the client_id parameter on OAuth requests.)

    You can register multiple client IDs with the same provider. For example, you might have multiple applications that use the same OIDC provider. You cannot register more than 100 client IDs with a single IAM OIDC provider.

    There is no defined format for a client ID. The CreateOpenIDConnectProviderRequest action accepts client IDs up to 255 characters long.

  • :thumbprint_list (required, Array<String>)

    A list of server certificate thumbprints for the OpenID Connect (OIDC) identity provider's server certificate(s). Typically this list includes only one entry. However, IAM lets you have up to five thumbprints for an OIDC provider. This lets you maintain multiple thumbprints if the identity provider is rotating certificates.

    The server certificate thumbprint is the hex-encoded SHA-1 hash value of the X.509 certificate used by the domain where the OpenID Connect provider makes its keys available. It is always a 40-character string.

    You must provide at least one thumbprint when creating an IAM OIDC provider. For example, if the OIDC provider is server.example.com and the provider stores its keys at "https://keys.server.example.com/openid-connect", the thumbprint string would be the hex-encoded SHA-1 hash value of the certificate used by https://keys.server.example.com.

    For more information about obtaining the OIDC provider's thumbprint, see Obtaining the Thumbprint for an OpenID Connect Provider in the IAM User Guide.

Returns:

See Also:



1098
1099
1100
1101
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1098

def create_open_id_connect_provider(params = {}, options = {})
  req = build_request(:create_open_id_connect_provider, params)
  req.send_request(options)
end

#create_policy(params = {}) ⇒ Types::CreatePolicyResponse

Creates a new managed policy for your AWS account.

This operation creates a policy version with a version identifier of v1 and sets v1 as the policy's default version. For more information about policy versions, see Versioning for Managed Policies in the IAM User Guide.

For more information about managed policies in general, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_policy({
  policy_name: "policyNameType", # required
  path: "policyPathType",
  policy_document: "policyDocumentType", # required
  description: "policyDescriptionType",
})

Response structure


resp.policy.policy_name #=> String
resp.policy.policy_id #=> String
resp.policy.arn #=> String
resp.policy.path #=> String
resp.policy.default_version_id #=> String
resp.policy.attachment_count #=> Integer
resp.policy.is_attachable #=> Boolean
resp.policy.description #=> String
resp.policy.create_date #=> Time
resp.policy.update_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_name (required, String)

    The friendly name of the policy.

    This parameter allows (per 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: =,.@-

  • :path (String)

    The path for the policy.

    For more information about paths, see IAM Identifiers in the IAM User Guide.

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :policy_document (required, String)

    The JSON policy document that you want to use as the content for the new policy.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :description (String)

    A friendly description of the policy.

    Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

    The policy description is immutable. After a value is assigned, it cannot be changed.

Returns:

See Also:



1207
1208
1209
1210
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1207

def create_policy(params = {}, options = {})
  req = build_request(:create_policy, params)
  req.send_request(options)
end

#create_policy_version(params = {}) ⇒ Types::CreatePolicyVersionResponse

Creates a new version of the specified managed policy. To update a managed policy, you create a new policy version. A managed policy can have up to five versions. If the policy has five versions, you must delete an existing version using DeletePolicyVersion before you create a new version.

Optionally, you can set the new version as the policy's default version. The default version is the version that is in effect for the IAM users, groups, and roles to which the policy is attached.

For more information about managed policy versions, see Versioning for Managed Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_policy_version({
  policy_arn: "arnType", # required
  policy_document: "policyDocumentType", # required
  set_as_default: false,
})

Response structure


resp.policy_version.document #=> String
resp.policy_version.version_id #=> String
resp.policy_version.is_default_version #=> Boolean
resp.policy_version.create_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :policy_document (required, String)

    The JSON policy document that you want to use as the content for this new version of the policy.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :set_as_default (Boolean)

    Specifies whether to set this version as the policy's default version.

    When this parameter is true, the new policy version becomes the operative version; that is, the version that is in effect for the IAM users, groups, and roles that the policy is attached to.

    For more information about managed policy versions, see Versioning for Managed Policies in the IAM User Guide.

Returns:

See Also:



1294
1295
1296
1297
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1294

def create_policy_version(params = {}, options = {})
  req = build_request(:create_policy_version, params)
  req.send_request(options)
end

#create_role(params = {}) ⇒ Types::CreateRoleResponse

Creates a new role for your AWS account. For more information about roles, go to Working with Roles. For information about limitations on role names and the number of roles you can create, go to Limitations on IAM Entities in the IAM User Guide.

Examples:

Example: To create an IAM role


# The following command creates a role named Test-Role and attaches a trust policy to it that is provided as a URL-encoded JSON string.

resp = client.create_role({
  assume_role_policy_document: "<URL-encoded-JSON>", 
  path: "/", 
  role_name: "Test-Role", 
})

resp.to_h outputs the following:
{
  role: {
    arn: "arn:aws:iam::123456789012:role/Test-Role", 
    assume_role_policy_document: "<URL-encoded-JSON>", 
    create_date: Time.parse("2013-06-07T20:43:32.821Z"), 
    path: "/", 
    role_id: "AKIAIOSFODNN7EXAMPLE", 
    role_name: "Test-Role", 
  }, 
}

Request syntax with placeholder values


resp = client.create_role({
  path: "pathType",
  role_name: "roleNameType", # required
  assume_role_policy_document: "policyDocumentType", # required
  description: "roleDescriptionType",
})

Response structure


resp.role.path #=> String
resp.role.role_name #=> String
resp.role.role_id #=> String
resp.role.arn #=> String
resp.role.create_date #=> Time
resp.role.assume_role_policy_document #=> String
resp.role.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path (String)

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

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :role_name (required, String)

    The name of the role to create.

    This parameter allows (per 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: _+=,.@-

    Role names are not distinguished by case. For example, you cannot create roles named both "PRODROLE" and "prodrole".

  • :assume_role_policy_document (required, String)

    The trust relationship policy document that grants an entity permission to assume the role.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :description (String)

    A customer-provided description of the role.

Returns:

See Also:



1412
1413
1414
1415
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1412

def create_role(params = {}, options = {})
  req = build_request(:create_role, params)
  req.send_request(options)
end

#create_saml_provider(params = {}) ⇒ Types::CreateSAMLProviderResponse

Creates an IAM resource that describes an identity provider (IdP) that supports SAML 2.0.

The SAML provider resource that you create with this operation can be used as a principal in an IAM role's trust policy to enable federated users who sign-in using the SAML IdP to assume the role. You can create an IAM role that supports Web-based single sign-on (SSO) to the AWS Management Console or one that supports API access to AWS.

When you create the SAML provider resource, you upload an a SAML metadata document that you get from your IdP and that includes the issuer's name, expiration information, and keys that can be used to validate the SAML authentication response (assertions) that the IdP sends. You must generate the metadata document using the identity management software that is used as your organization's IdP.

This operation requires Signature Version 4.

For more information, see Enabling SAML 2.0 Federated Users to Access the AWS Management Console and About SAML 2.0-based Federation in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_saml_provider({
  saml_metadata_document: "SAMLMetadataDocumentType", # required
  name: "SAMLProviderNameType", # required
})

Response structure


resp.saml_provider_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :saml_metadata_document (required, String)

    An XML document generated by an identity provider (IdP) that supports SAML 2.0. The document includes the issuer's name, expiration information, and keys that can be used to validate the SAML authentication response (assertions) that are received from the IdP. You must generate the metadata document using the identity management software that is used as your organization's IdP.

    For more information, see About SAML 2.0-based Federation in the IAM User Guide

  • :name (required, String)

    The name of the provider to create.

    This parameter allows (per 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:

See Also:



1493
1494
1495
1496
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1493

def create_saml_provider(params = {}, options = {})
  req = build_request(:create_saml_provider, params)
  req.send_request(options)
end

#create_service_linked_role(params = {}) ⇒ Types::CreateServiceLinkedRoleResponse

Creates an IAM role that is linked to a specific AWS service. The service controls the attached policies and when the role can be deleted. This helps ensure that the service is not broken by an unexpectedly changed or deleted role, which could put your AWS resources into an unknown state. Allowing the service to control the role helps improve service stability and proper cleanup when a service and its role are no longer needed.

The name of the role is autogenerated by combining the string that you specify for the AWSServiceName parameter with the string that you specify for the CustomSuffix parameter. The resulting name must be unique in your account or the request fails.

To attach a policy to this service-linked role, you must make the request using the AWS service that depends on this role.

Examples:

Request syntax with placeholder values


resp = client.create_service_linked_role({
  aws_service_name: "groupNameType", # required
  description: "roleDescriptionType",
  custom_suffix: "customSuffixType",
})

Response structure


resp.role.path #=> String
resp.role.role_name #=> String
resp.role.role_id #=> String
resp.role.arn #=> String
resp.role.create_date #=> Time
resp.role.assume_role_policy_document #=> String
resp.role.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :aws_service_name (required, String)

    The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com

  • :description (String)

    The description of the role.

  • :custom_suffix (String)

    A string that you provide, which is combined with the service name to form the complete role name. If you make multiple requests for the same service, then you must supply a different CustomSuffix for each request. Otherwise the request fails with a duplicate role name error. For example, you could add -1 or -debug to the suffix.

Returns:

See Also:



1555
1556
1557
1558
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1555

def create_service_linked_role(params = {}, options = {})
  req = build_request(:create_service_linked_role, params)
  req.send_request(options)
end

#create_service_specific_credential(params = {}) ⇒ Types::CreateServiceSpecificCredentialResponse

Generates a set of credentials consisting of a user name and password that can be used to access the service specified in the request. These credentials are generated by IAM, and can be used only for the specified service.

You can have a maximum of two sets of service-specific credentials for each supported service per user.

The only supported service at this time is AWS CodeCommit.

You can reset the password to a new service-generated value by calling ResetServiceSpecificCredential.

For more information about service-specific credentials, see Using IAM with AWS CodeCommit: Git Credentials, SSH Keys, and AWS Access Keys in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_service_specific_credential({
  user_name: "userNameType", # required
  service_name: "serviceName", # required
})

Response structure


resp.service_specific_credential.create_date #=> Time
resp.service_specific_credential.service_name #=> String
resp.service_specific_credential.service_user_name #=> String
resp.service_specific_credential.service_password #=> String
resp.service_specific_credential.service_specific_credential_id #=> String
resp.service_specific_credential.user_name #=> String
resp.service_specific_credential.status #=> String, one of "Active", "Inactive"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.

    This parameter allows (per 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: =,.@-

  • :service_name (required, String)

    The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.

Returns:

See Also:



1626
1627
1628
1629
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1626

def create_service_specific_credential(params = {}, options = {})
  req = build_request(:create_service_specific_credential, params)
  req.send_request(options)
end

#create_user(params = {}) ⇒ Types::CreateUserResponse

Creates a new IAM user for your AWS account.

For information about limitations on the number of IAM users you can create, see Limitations on IAM Entities in the IAM User Guide.

Examples:

Example: To create an IAM user


# The following create-user command creates an IAM user named Bob in the current account.

resp = client.create_user({
  user_name: "Bob", 
})

resp.to_h outputs the following:
{
  user: {
    arn: "arn:aws:iam::123456789012:user/Bob", 
    create_date: Time.parse("2013-06-08T03:20:41.270Z"), 
    path: "/", 
    user_id: "AKIAIOSFODNN7EXAMPLE", 
    user_name: "Bob", 
  }, 
}

Request syntax with placeholder values


resp = client.create_user({
  path: "pathType",
  user_name: "userNameType", # required
})

Response structure


resp.user.path #=> String
resp.user.user_name #=> String
resp.user.user_id #=> String
resp.user.arn #=> String
resp.user.create_date #=> Time
resp.user.password_last_used #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path (String)

    The path for the user name. For more information about paths, see IAM Identifiers in the IAM User Guide.

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :user_name (required, String)

    The name of the user to create.

    This parameter allows (per 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: =,.@-. User names are not distinguished by case. For example, you cannot create users named both "TESTUSER" and "testuser".

Returns:

See Also:



1716
1717
1718
1719
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1716

def create_user(params = {}, options = {})
  req = build_request(:create_user, params)
  req.send_request(options)
end

#create_virtual_mfa_device(params = {}) ⇒ Types::CreateVirtualMFADeviceResponse

Creates a new virtual MFA device for the AWS account. After creating the virtual MFA, use EnableMFADevice to attach the MFA device to an IAM user. For more information about creating and working with virtual MFA devices, go to Using a Virtual MFA Device in the IAM User Guide.

For information about limits on the number of MFA devices you can create, see Limitations on Entities in the IAM User Guide.

The seed information contained in the QR code and the Base32 string should be treated like any other secret access information, such as your AWS access keys or your passwords. After you provision your virtual device, you should ensure that the information is destroyed following secure procedures.

Examples:

Request syntax with placeholder values


resp = client.create_virtual_mfa_device({
  path: "pathType",
  virtual_mfa_device_name: "virtualMFADeviceName", # required
})

Response structure


resp.virtual_mfa_device.serial_number #=> String
resp.virtual_mfa_device.base_32_string_seed #=> String
resp.virtual_mfa_device.qr_code_png #=> String
resp.virtual_mfa_device.user.path #=> String
resp.virtual_mfa_device.user.user_name #=> String
resp.virtual_mfa_device.user.user_id #=> String
resp.virtual_mfa_device.user.arn #=> String
resp.virtual_mfa_device.user.create_date #=> Time
resp.virtual_mfa_device.user.password_last_used #=> Time
resp.virtual_mfa_device.enable_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path (String)

    The path for the virtual MFA device. For more information about paths, see IAM Identifiers in the IAM User Guide.

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :virtual_mfa_device_name (required, String)

    The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.

    This parameter allows (per 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:

See Also:



1801
1802
1803
1804
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1801

def create_virtual_mfa_device(params = {}, options = {})
  req = build_request(:create_virtual_mfa_device, params)
  req.send_request(options)
end

#deactivate_mfa_device(params = {}) ⇒ Struct

Deactivates the specified MFA device and removes it from association with the user name for which it was originally enabled.

For more information about creating and working with virtual MFA devices, go to Using a Virtual MFA Device in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.deactivate_mfa_device({
  user_name: "existingUserNameType", # required
  serial_number: "serialNumberType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user whose MFA device you want to deactivate.

    This parameter allows (per 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: =,.@-

  • :serial_number (required, String)

    The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN.

    This parameter allows (per 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:



1855
1856
1857
1858
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1855

def deactivate_mfa_device(params = {}, options = {})
  req = build_request(:deactivate_mfa_device, params)
  req.send_request(options)
end

#delete_access_key(params = {}) ⇒ Struct

Deletes the access key pair associated with the specified IAM user.

If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID signing the request. Because this action works for access keys under the AWS account, you can use this action to manage root credentials even if the AWS account has no associated users.

Examples:

Example: To delete an access key for an IAM user


# The following command deletes one access key (access key ID and secret access key) assigned to the IAM user named Bob.

resp = client.delete_access_key({
  access_key_id: "AKIDPMS9RO4H3FEXAMPLE", 
  user_name: "Bob", 
})

Request syntax with placeholder values


resp = client.delete_access_key({
  user_name: "existingUserNameType",
  access_key_id: "accessKeyIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the user whose access key pair you want to delete.

    This parameter allows (per 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: =,.@-

  • :access_key_id (required, String)

    The access key ID for the access key ID and secret access key you want to delete.

    This parameter allows (per its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1915
1916
1917
1918
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1915

def delete_access_key(params = {}, options = {})
  req = build_request(:delete_access_key, params)
  req.send_request(options)
end

#delete_account_alias(params = {}) ⇒ Struct

Deletes the specified AWS account alias. For information about using an AWS account alias, see Using an Alias for Your AWS Account ID in the IAM User Guide.

Examples:

Example: To delete an account alias


# The following command removes the alias mycompany from the current AWS account:

resp = client.({
  account_alias: "mycompany", 
})

Request syntax with placeholder values


resp = client.({
  account_alias: "accountAliasType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_alias (required, String)

    The name of the account alias to delete.

    This parameter allows (per its regex pattern) a string of characters consisting of lowercase letters, digits, and dashes. You cannot start or finish with a dash, nor can you have two dashes in a row.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1961
1962
1963
1964
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1961

def (params = {}, options = {})
  req = build_request(:delete_account_alias, params)
  req.send_request(options)
end

#delete_account_password_policy(params = {}) ⇒ Struct

Deletes the password policy for the AWS account. There are no parameters.

Examples:

Example: To delete the current account password policy


# The following command removes the password policy from the current AWS account:

resp = client.({
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1983
1984
1985
1986
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 1983

def (params = {}, options = {})
  req = build_request(:delete_account_password_policy, params)
  req.send_request(options)
end

#delete_group(params = {}) ⇒ Struct

Deletes the specified IAM group. The group must not contain any users or have any attached policies.

Examples:

Request syntax with placeholder values


resp = client.delete_group({
  group_name: "groupNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the IAM group to delete.

    This parameter allows (per 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:



2015
2016
2017
2018
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2015

def delete_group(params = {}, options = {})
  req = build_request(:delete_group, params)
  req.send_request(options)
end

#delete_group_policy(params = {}) ⇒ Struct

Deletes the specified inline policy that is embedded in the specified IAM group.

A group can also have managed policies attached to it. To detach a managed policy from a group, use DetachGroupPolicy. For more information about policies, refer to Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Example: To delete a policy from an IAM group


# The following command deletes the policy named ExamplePolicy from the group named Admins:

resp = client.delete_group_policy({
  group_name: "Admins", 
  policy_name: "ExamplePolicy", 
})

Request syntax with placeholder values


resp = client.delete_group_policy({
  group_name: "groupNameType", # required
  policy_name: "policyNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name (friendly name, not ARN) identifying the group that the policy is embedded in.

    This parameter allows (per 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: =,.@-

  • :policy_name (required, String)

    The name identifying the policy document to delete.

    This parameter allows (per 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:



2080
2081
2082
2083
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2080

def delete_group_policy(params = {}, options = {})
  req = build_request(:delete_group_policy, params)
  req.send_request(options)
end

#delete_instance_profile(params = {}) ⇒ Struct

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

Make sure 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:

Example: To delete an instance profile


# The following command deletes the instance profile named ExampleInstanceProfile

resp = client.delete_instance_profile({
  instance_profile_name: "ExampleInstanceProfile", 
})

Request syntax with placeholder values


resp = client.delete_instance_profile({
  instance_profile_name: "instanceProfileNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_profile_name (required, String)

    The name of the instance profile to delete.

    This parameter allows (per 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:



2133
2134
2135
2136
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2133

def delete_instance_profile(params = {}, options = {})
  req = build_request(:delete_instance_profile, params)
  req.send_request(options)
end

#delete_login_profile(params = {}) ⇒ Struct

Deletes the password for the specified IAM user, which terminates the user's ability to access AWS services through the AWS Management Console.

Deleting a user's password does not prevent a user from accessing AWS through the command line interface or the API. To prevent all user access you must also either make any access keys inactive or delete them. For more information about making keys inactive or deleting them, see UpdateAccessKey and DeleteAccessKey.

Examples:

Example: To delete a password for an IAM user


# The following command deletes the password for the IAM user named Bob.

resp = client.({
  user_name: "Bob", 
})

Request syntax with placeholder values


resp = client.({
  user_name: "userNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user whose password you want to delete.

    This parameter allows (per 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:



2181
2182
2183
2184
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2181

def (params = {}, options = {})
  req = build_request(:delete_login_profile, params)
  req.send_request(options)
end

#delete_open_id_connect_provider(params = {}) ⇒ Struct

Deletes an OpenID Connect identity provider (IdP) resource object in IAM.

Deleting an IAM OIDC provider resource does not update any roles that reference the provider as a principal in their trust policies. Any attempt to assume a role that references a deleted provider fails.

This action is idempotent; it does not fail or return an error if you call the action for a provider that does not exist.

Examples:

Request syntax with placeholder values


resp = client.delete_open_id_connect_provider({
  open_id_connect_provider_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :open_id_connect_provider_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM OpenID Connect provider resource object to delete. You can get a list of OpenID Connect provider resource ARNs by using the ListOpenIDConnectProviders action.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2213
2214
2215
2216
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2213

def delete_open_id_connect_provider(params = {}, options = {})
  req = build_request(:delete_open_id_connect_provider, params)
  req.send_request(options)
end

#delete_policy(params = {}) ⇒ Struct

Deletes the specified managed policy.

Before you can delete a managed policy, you must first detach the policy from all users, groups, and roles that it is attached to, and you must delete all of the policy's versions. The following steps describe the process for deleting a managed policy:

  • Detach the policy from all users, groups, and roles that the policy is attached to, using the DetachUserPolicy, DetachGroupPolicy, or DetachRolePolicy APIs. To list all the users, groups, and roles that a policy is attached to, use ListEntitiesForPolicy.

  • Delete all versions of the policy using DeletePolicyVersion. To list the policy's versions, use ListPolicyVersions. You cannot use DeletePolicyVersion to delete the version that is marked as the default version. You delete the policy's default version in the next step of the process.

  • Delete the policy (this automatically deletes the policy's default version) using this API.

For information about managed policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.delete_policy({
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2268
2269
2270
2271
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2268

def delete_policy(params = {}, options = {})
  req = build_request(:delete_policy, params)
  req.send_request(options)
end

#delete_policy_version(params = {}) ⇒ Struct

Deletes the specified version from the specified managed policy.

You cannot delete the default version from a policy using this API. To delete the default version from a policy, use DeletePolicy. To find out which version of a policy is marked as the default version, use ListPolicyVersions.

For information about versions for managed policies, see Versioning for Managed Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.delete_policy_version({
  policy_arn: "arnType", # required
  version_id: "policyVersionIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy from which you want to delete a version.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :version_id (required, String)

    The policy version to delete.

    This parameter allows (per its regex pattern) a string of characters that consists of the lowercase letter 'v' followed by one or two digits, and optionally followed by a period '.' and a string of letters and digits.

    For more information about managed policy versions, see Versioning for Managed Policies in the IAM User Guide.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2327
2328
2329
2330
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2327

def delete_policy_version(params = {}, options = {})
  req = build_request(:delete_policy_version, params)
  req.send_request(options)
end

#delete_role(params = {}) ⇒ Struct

Deletes the specified role. The role must not have any policies attached. For more information about roles, go to Working with Roles.

Make sure you do not have any Amazon EC2 instances running with the role 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.

Examples:

Example: To delete an IAM role


# The following command removes the role named Test-Role.

resp = client.delete_role({
  role_name: "Test-Role", 
})

Request syntax with placeholder values


resp = client.delete_role({
  role_name: "roleNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name of the role to delete.

    This parameter allows (per 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:



2378
2379
2380
2381
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2378

def delete_role(params = {}, options = {})
  req = build_request(:delete_role, params)
  req.send_request(options)
end

#delete_role_policy(params = {}) ⇒ Struct

Deletes the specified inline policy that is embedded in the specified IAM role.

A role can also have managed policies attached to it. To detach a managed policy from a role, use DetachRolePolicy. For more information about policies, refer to Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Example: To remove a policy from an IAM role


# The following command removes the policy named ExamplePolicy from the role named Test-Role.

resp = client.delete_role_policy({
  policy_name: "ExamplePolicy", 
  role_name: "Test-Role", 
})

Request syntax with placeholder values


resp = client.delete_role_policy({
  role_name: "roleNameType", # required
  policy_name: "policyNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name (friendly name, not ARN) identifying the role that the policy is embedded in.

    This parameter allows (per 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: _+=,.@-

  • :policy_name (required, String)

    The name of the inline policy to delete from the specified IAM role.

    This parameter allows (per 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:



2443
2444
2445
2446
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2443

def delete_role_policy(params = {}, options = {})
  req = build_request(:delete_role_policy, params)
  req.send_request(options)
end

#delete_saml_provider(params = {}) ⇒ Struct

Deletes a SAML provider resource in IAM.

Deleting the provider resource from IAM does not update any roles that reference the SAML provider resource's ARN as a principal in their trust policies. Any attempt to assume a role that references a non-existent provider resource ARN fails.

This operation requires Signature Version 4.

Examples:

Request syntax with placeholder values


resp = client.delete_saml_provider({
  saml_provider_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :saml_provider_arn (required, String)

    The Amazon Resource Name (ARN) of the SAML provider to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2478
2479
2480
2481
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2478

def delete_saml_provider(params = {}, options = {})
  req = build_request(:delete_saml_provider, params)
  req.send_request(options)
end

#delete_server_certificate(params = {}) ⇒ Struct

Deletes the specified server certificate.

For more information about working with server certificates, including a list of AWS services that can use the server certificates that you manage with IAM, go to Working with Server Certificates in the IAM User Guide.

If you are using a server certificate with Elastic Load Balancing, deleting the certificate could have implications for your application. If Elastic Load Balancing doesn't detect the deletion of bound certificates, it may continue to use the certificates. This could cause Elastic Load Balancing to stop accepting traffic. We recommend that you remove the reference to the certificate from Elastic Load Balancing before using this command to delete the certificate. For more information, go to DeleteLoadBalancerListeners in the Elastic Load Balancing API Reference.

Examples:

Request syntax with placeholder values


resp = client.delete_server_certificate({
  server_certificate_name: "serverCertificateNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :server_certificate_name (required, String)

    The name of the server certificate you want to delete.

    This parameter allows (per 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:



2582
2583
2584
2585
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2582

def delete_server_certificate(params = {}, options = {})
  req = build_request(:delete_server_certificate, params)
  req.send_request(options)
end

#delete_service_specific_credential(params = {}) ⇒ Struct

Deletes the specified service-specific credential.

Examples:

Request syntax with placeholder values


resp = client.delete_service_specific_credential({
  user_name: "userNameType",
  service_specific_credential_id: "serviceSpecificCredentialId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the IAM user associated with the service-specific credential. If this value is not specified, then the operation assumes the user whose credentials are used to call the operation.

    This parameter allows (per 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: =,.@-

  • :service_specific_credential_id (required, String)

    The unique identifier of the service-specific credential. You can get this value by calling ListServiceSpecificCredentials.

    This parameter allows (per its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2628
2629
2630
2631
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2628

def delete_service_specific_credential(params = {}, options = {})
  req = build_request(:delete_service_specific_credential, params)
  req.send_request(options)
end

#delete_signing_certificate(params = {}) ⇒ Struct

Deletes a signing certificate associated with the specified IAM user.

If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID signing the request. Because this action works for access keys under the AWS account, you can use this action to manage root credentials even if the AWS account has no associated IAM users.

Examples:

Example: To delete a signing certificate for an IAM user


# The following command deletes the specified signing certificate for the IAM user named Anika.

resp = client.delete_signing_certificate({
  certificate_id: "TA7SMP42TDN5Z26OBPJE7EXAMPLE", 
  user_name: "Anika", 
})

Request syntax with placeholder values


resp = client.delete_signing_certificate({
  user_name: "existingUserNameType",
  certificate_id: "certificateIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the user the signing certificate belongs to.

    This parameter allows (per 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: =,.@-

  • :certificate_id (required, String)

    The ID of the signing certificate to delete.

    The format of this parameter, as described by its regex pattern, is a string of characters that can be upper- or lower-cased letters or digits.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2687
2688
2689
2690
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2687

def delete_signing_certificate(params = {}, options = {})
  req = build_request(:delete_signing_certificate, params)
  req.send_request(options)
end

#delete_ssh_public_key(params = {}) ⇒ Struct

Deletes the specified SSH public key.

The SSH public key deleted by this action is used only for authenticating the associated IAM user to an AWS CodeCommit repository. For more information about using SSH keys to authenticate to an AWS CodeCommit repository, see Set up AWS CodeCommit for SSH Connections in the AWS CodeCommit User Guide.

Examples:

Request syntax with placeholder values


resp = client.delete_ssh_public_key({
  user_name: "userNameType", # required
  ssh_public_key_id: "publicKeyIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the IAM user associated with the SSH public key.

    This parameter allows (per 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: =,.@-

  • :ssh_public_key_id (required, String)

    The unique identifier for the SSH public key.

    This parameter allows (per its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2531
2532
2533
2534
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2531

def delete_ssh_public_key(params = {}, options = {})
  req = build_request(:delete_ssh_public_key, params)
  req.send_request(options)
end

#delete_user(params = {}) ⇒ Struct

Deletes the specified IAM user. The user must not belong to any groups or have any access keys, signing certificates, or attached policies.

Examples:

Example: To delete an IAM user


# The following command removes the IAM user named Bob from the current account.

resp = client.delete_user({
  user_name: "Bob", 
})

Request syntax with placeholder values


resp = client.delete_user({
  user_name: "existingUserNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user to delete.

    This parameter allows (per 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:



2728
2729
2730
2731
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2728

def delete_user(params = {}, options = {})
  req = build_request(:delete_user, params)
  req.send_request(options)
end

#delete_user_policy(params = {}) ⇒ Struct

Deletes the specified inline policy that is embedded in the specified IAM user.

A user can also have managed policies attached to it. To detach a managed policy from a user, use DetachUserPolicy. For more information about policies, refer to Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Example: To remove a policy from an IAM user


# The following delete-user-policy command removes the specified policy from the IAM user named Juan:

resp = client.delete_user_policy({
  policy_name: "ExamplePolicy", 
  user_name: "Juan", 
})

Request syntax with placeholder values


resp = client.delete_user_policy({
  user_name: "existingUserNameType", # required
  policy_name: "policyNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name (friendly name, not ARN) identifying the user that the policy is embedded in.

    This parameter allows (per 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: =,.@-

  • :policy_name (required, String)

    The name identifying the policy document to delete.

    This parameter allows (per 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:



2793
2794
2795
2796
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2793

def delete_user_policy(params = {}, options = {})
  req = build_request(:delete_user_policy, params)
  req.send_request(options)
end

#delete_virtual_mfa_device(params = {}) ⇒ Struct

Deletes a virtual MFA device.

You must deactivate a user's virtual MFA device before you can delete it. For information about deactivating MFA devices, see DeactivateMFADevice.

Examples:

Example: To remove a virtual MFA device


# The following delete-virtual-mfa-device command removes the specified MFA device from the current AWS account.

resp = client.delete_virtual_mfa_device({
  serial_number: "arn:aws:iam::123456789012:mfa/ExampleName", 
})

Request syntax with placeholder values


resp = client.delete_virtual_mfa_device({
  serial_number: "serialNumberType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :serial_number (required, String)

    The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the same as the ARN.

    This parameter allows (per 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:



2840
2841
2842
2843
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2840

def delete_virtual_mfa_device(params = {}, options = {})
  req = build_request(:delete_virtual_mfa_device, params)
  req.send_request(options)
end

#detach_group_policy(params = {}) ⇒ Struct

Removes the specified managed policy from the specified IAM group.

A group can also have inline policies embedded with it. To delete an inline policy, use the DeleteGroupPolicy API. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.detach_group_policy({
  group_name: "groupNameType", # required
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name (friendly name, not ARN) of the IAM group to detach the policy from.

    This parameter allows (per 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: =,.@-

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy you want to detach.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2892
2893
2894
2895
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2892

def detach_group_policy(params = {}, options = {})
  req = build_request(:detach_group_policy, params)
  req.send_request(options)
end

#detach_role_policy(params = {}) ⇒ Struct

Removes the specified managed policy from the specified role.

A role can also have inline policies embedded with it. To delete an inline policy, use the DeleteRolePolicy API. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.detach_role_policy({
  role_name: "roleNameType", # required
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name (friendly name, not ARN) of the IAM role to detach the policy from.

    This parameter allows (per 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: _+=,.@-

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy you want to detach.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2944
2945
2946
2947
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2944

def detach_role_policy(params = {}, options = {})
  req = build_request(:detach_role_policy, params)
  req.send_request(options)
end

#detach_user_policy(params = {}) ⇒ Struct

Removes the specified managed policy from the specified user.

A user can also have inline policies embedded with it. To delete an inline policy, use the DeleteUserPolicy API. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.detach_user_policy({
  user_name: "userNameType", # required
  policy_arn: "arnType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name (friendly name, not ARN) of the IAM user to detach the policy from.

    This parameter allows (per 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: =,.@-

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy you want to detach.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2996
2997
2998
2999
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 2996

def detach_user_policy(params = {}, options = {})
  req = build_request(:detach_user_policy, params)
  req.send_request(options)
end

#enable_mfa_device(params = {}) ⇒ Struct

Enables the specified MFA device and associates it with the specified IAM user. When enabled, the MFA device is required for every subsequent login by the IAM user associated with the device.

Examples:

Request syntax with placeholder values


resp = client.enable_mfa_device({
  user_name: "existingUserNameType", # required
  serial_number: "serialNumberType", # required
  authentication_code_1: "authenticationCodeType", # required
  authentication_code_2: "authenticationCodeType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the IAM user for whom you want to enable the MFA device.

    This parameter allows (per 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: =,.@-

  • :serial_number (required, String)

    The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN.

    This parameter allows (per 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: =,.@:/-

  • :authentication_code_1 (required, String)

    An authentication code emitted by the device.

    The format for this parameter is a string of 6 digits.

    Submit your request immediately after generating the authentication codes. If you generate the codes and then wait too long to submit the request, the MFA device successfully associates with the user but the MFA device becomes out of sync. This happens because time-based one-time passwords (TOTP) expire after a short period of time. If this happens, you can resync the device.

  • :authentication_code_2 (required, String)

    A subsequent authentication code emitted by the device.

    The format for this parameter is a string of 6 digits.

    Submit your request immediately after generating the authentication codes. If you generate the codes and then wait too long to submit the request, the MFA device successfully associates with the user but the MFA device becomes out of sync. This happens because time-based one-time passwords (TOTP) expire after a short period of time. If this happens, you can resync the device.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3077
3078
3079
3080
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3077

def enable_mfa_device(params = {}, options = {})
  req = build_request(:enable_mfa_device, params)
  req.send_request(options)
end

#generate_credential_report(params = {}) ⇒ Types::GenerateCredentialReportResponse

Generates a credential report for the AWS account. For more information about the credential report, see Getting Credential Reports in the IAM User Guide.

Examples:

Response structure


resp.state #=> String, one of "STARTED", "INPROGRESS", "COMPLETE"
resp.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



3104
3105
3106
3107
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3104

def generate_credential_report(params = {}, options = {})
  req = build_request(:generate_credential_report, params)
  req.send_request(options)
end

#get_access_key_last_used(params = {}) ⇒ Types::GetAccessKeyLastUsedResponse

Retrieves information about when the specified access key was last used. The information includes the date and time of last use, along with the AWS service and region that were specified in the last request made with that key.

Examples:

Request syntax with placeholder values


resp = client.get_access_key_last_used({
  access_key_id: "accessKeyIdType", # required
})

Response structure


resp.user_name #=> String
resp.access_key_last_used.last_used_date #=> Time
resp.access_key_last_used.service_name #=> String
resp.access_key_last_used.region #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_key_id (required, String)

    The identifier of an access key.

    This parameter allows (per its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.

Returns:

See Also:



3147
3148
3149
3150
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3147

def get_access_key_last_used(params = {}, options = {})
  req = build_request(:get_access_key_last_used, params)
  req.send_request(options)
end

#get_account_authorization_details(params = {}) ⇒ Types::GetAccountAuthorizationDetailsResponse

Retrieves information about all IAM users, groups, roles, and policies in your AWS account, including their relationships to one another. Use this API to obtain a snapshot of the configuration of IAM permissions (users, groups, roles, and policies) in your account.

You can optionally filter the results using the Filter parameter. You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.({
  filter: ["User"], # accepts User, Role, Group, LocalManagedPolicy, AWSManagedPolicy
  max_items: 1,
  marker: "markerType",
})

Response structure


resp.user_detail_list #=> Array
resp.user_detail_list[0].path #=> String
resp.user_detail_list[0].user_name #=> String
resp.user_detail_list[0].user_id #=> String
resp.user_detail_list[0].arn #=> String
resp.user_detail_list[0].create_date #=> Time
resp.user_detail_list[0].user_policy_list #=> Array
resp.user_detail_list[0].user_policy_list[0].policy_name #=> String
resp.user_detail_list[0].user_policy_list[0].policy_document #=> String
resp.user_detail_list[0].group_list #=> Array
resp.user_detail_list[0].group_list[0] #=> String
resp.user_detail_list[0].attached_managed_policies #=> Array
resp.user_detail_list[0].attached_managed_policies[0].policy_name #=> String
resp.user_detail_list[0].attached_managed_policies[0].policy_arn #=> String
resp.group_detail_list #=> Array
resp.group_detail_list[0].path #=> String
resp.group_detail_list[0].group_name #=> String
resp.group_detail_list[0].group_id #=> String
resp.group_detail_list[0].arn #=> String
resp.group_detail_list[0].create_date #=> Time
resp.group_detail_list[0].group_policy_list #=> Array
resp.group_detail_list[0].group_policy_list[0].policy_name #=> String
resp.group_detail_list[0].group_policy_list[0].policy_document #=> String
resp.group_detail_list[0].attached_managed_policies #=> Array
resp.group_detail_list[0].attached_managed_policies[0].policy_name #=> String
resp.group_detail_list[0].attached_managed_policies[0].policy_arn #=> String
resp.role_detail_list #=> Array
resp.role_detail_list[0].path #=> String
resp.role_detail_list[0].role_name #=> String
resp.role_detail_list[0].role_id #=> String
resp.role_detail_list[0].arn #=> String
resp.role_detail_list[0].create_date #=> Time
resp.role_detail_list[0].assume_role_policy_document #=> String
resp.role_detail_list[0].instance_profile_list #=> Array
resp.role_detail_list[0].instance_profile_list[0].path #=> String
resp.role_detail_list[0].instance_profile_list[0].instance_profile_name #=> String
resp.role_detail_list[0].instance_profile_list[0].instance_profile_id #=> String
resp.role_detail_list[0].instance_profile_list[0].arn #=> String
resp.role_detail_list[0].instance_profile_list[0].create_date #=> Time
resp.role_detail_list[0].instance_profile_list[0].roles #=> Array
resp.role_detail_list[0].instance_profile_list[0].roles[0].path #=> String
resp.role_detail_list[0].instance_profile_list[0].roles[0].role_name #=> String
resp.role_detail_list[0].instance_profile_list[0].roles[0].role_id #=> String
resp.role_detail_list[0].instance_profile_list[0].roles[0].arn #=> String
resp.role_detail_list[0].instance_profile_list[0].roles[0].create_date #=> Time
resp.role_detail_list[0].instance_profile_list[0].roles[0].assume_role_policy_document #=> String
resp.role_detail_list[0].instance_profile_list[0].roles[0].description #=> String
resp.role_detail_list[0].role_policy_list #=> Array
resp.role_detail_list[0].role_policy_list[0].policy_name #=> String
resp.role_detail_list[0].role_policy_list[0].policy_document #=> String
resp.role_detail_list[0].attached_managed_policies #=> Array
resp.role_detail_list[0].attached_managed_policies[0].policy_name #=> String
resp.role_detail_list[0].attached_managed_policies[0].policy_arn #=> String
resp.policies #=> Array
resp.policies[0].policy_name #=> String
resp.policies[0].policy_id #=> String
resp.policies[0].arn #=> String
resp.policies[0].path #=> String
resp.policies[0].default_version_id #=> String
resp.policies[0].attachment_count #=> Integer
resp.policies[0].is_attachable #=> Boolean
resp.policies[0].description #=> String
resp.policies[0].create_date #=> Time
resp.policies[0].update_date #=> Time
resp.policies[0].policy_version_list #=> Array
resp.policies[0].policy_version_list[0].document #=> String
resp.policies[0].policy_version_list[0].version_id #=> String
resp.policies[0].policy_version_list[0].is_default_version #=> Boolean
resp.policies[0].policy_version_list[0].create_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :filter (Array<String>)

    A list of entity types used to filter the results. Only the entities that match the types you specify are included in the output. Use the value LocalManagedPolicy to include customer managed policies.

    The format for this parameter is a comma-separated (if more than one) list of strings. Each string value in the list must be one of the valid values listed below.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

Returns:

See Also:



3283
3284
3285
3286
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3283

def (params = {}, options = {})
  req = build_request(:get_account_authorization_details, params)
  req.send_request(options)
end

#get_account_password_policy(params = {}) ⇒ Types::GetAccountPasswordPolicyResponse

Retrieves the password policy for the AWS account. For more information about using a password policy, go to Managing an IAM Password Policy.

Examples:

Example: To see the current account password policy


# The following command displays details about the password policy for the current AWS account.

resp = client.({
})

resp.to_h outputs the following:
{
  password_policy: {
    allow_users_to_change_password: false, 
    expire_passwords: false, 
    hard_expiry: false, 
    max_password_age: 90, 
    minimum_password_length: 8, 
    password_reuse_prevention: 12, 
    require_lowercase_characters: false, 
    require_numbers: true, 
    require_symbols: true, 
    require_uppercase_characters: false, 
  }, 
}

Response structure


resp.password_policy.minimum_password_length #=> Integer
resp.password_policy.require_symbols #=> Boolean
resp.password_policy.require_numbers #=> Boolean
resp.password_policy.require_uppercase_characters #=> Boolean
resp.password_policy.require_lowercase_characters #=> Boolean
resp.password_policy.allow_users_to_change_password #=> Boolean
resp.password_policy.expire_passwords #=> Boolean
resp.password_policy.max_password_age #=> Integer
resp.password_policy.password_reuse_prevention #=> Integer
resp.password_policy.hard_expiry #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



3341
3342
3343
3344
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3341

def (params = {}, options = {})
  req = build_request(:get_account_password_policy, params)
  req.send_request(options)
end

#get_account_summary(params = {}) ⇒ Types::GetAccountSummaryResponse

Retrieves information about IAM entity usage and IAM quotas in the AWS account.

For information about limitations on IAM entities, see Limitations on IAM Entities in the IAM User Guide.

Examples:

Example: To get information about IAM entity quotas and usage in the current account


# The following command returns information about the IAM entity quotas and usage in the current AWS account.

resp = client.({
})

resp.to_h outputs the following:
{
  summary_map: {
    "AccessKeysPerUserQuota" => 2, 
    "AccountAccessKeysPresent" => 1, 
    "AccountMFAEnabled" => 0, 
    "AccountSigningCertificatesPresent" => 0, 
    "AttachedPoliciesPerGroupQuota" => 10, 
    "AttachedPoliciesPerRoleQuota" => 10, 
    "AttachedPoliciesPerUserQuota" => 10, 
    "GroupPolicySizeQuota" => 5120, 
    "Groups" => 15, 
    "GroupsPerUserQuota" => 10, 
    "GroupsQuota" => 100, 
    "MFADevices" => 6, 
    "MFADevicesInUse" => 3, 
    "Policies" => 8, 
    "PoliciesQuota" => 1000, 
    "PolicySizeQuota" => 5120, 
    "PolicyVersionsInUse" => 22, 
    "PolicyVersionsInUseQuota" => 10000, 
    "ServerCertificates" => 1, 
    "ServerCertificatesQuota" => 20, 
    "SigningCertificatesPerUserQuota" => 2, 
    "UserPolicySizeQuota" => 2048, 
    "Users" => 27, 
    "UsersQuota" => 5000, 
    "VersionsPerPolicyQuota" => 5, 
  }, 
}

Response structure


resp.summary_map #=> Hash
resp.summary_map["summaryKeyType"] #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



3408
3409
3410
3411
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3408

def (params = {}, options = {})
  req = build_request(:get_account_summary, params)
  req.send_request(options)
end

#get_context_keys_for_custom_policy(params = {}) ⇒ Types::GetContextKeysForPolicyResponse

Gets a list of all of the context keys referenced in the input policies. The policies are supplied as a list of one or more strings. To get the context keys from policies associated with an IAM user, group, or role, use GetContextKeysForPrincipalPolicy.

Context keys are variables maintained by AWS and its services that provide details about the context of an API query request, and can be evaluated by testing against a value specified in an IAM policy. Use GetContextKeysForCustomPolicy to understand what key names and values you must supply when you call SimulateCustomPolicy. Note that all parameters are shown in unencoded form here for clarity, but must be URL encoded to be included as a part of a real HTML request.

Examples:

Request syntax with placeholder values


resp = client.get_context_keys_for_custom_policy({
  policy_input_list: ["policyDocumentType"], # required
})

Response structure


resp.context_key_names #=> Array
resp.context_key_names[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_input_list (required, Array<String>)

    A list of policies for which you want the list of context keys referenced in those policies. Each document is specified as a string containing the complete, valid JSON text of an IAM policy.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

Returns:

See Also:



3462
3463
3464
3465
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3462

def get_context_keys_for_custom_policy(params = {}, options = {})
  req = build_request(:get_context_keys_for_custom_policy, params)
  req.send_request(options)
end

#get_context_keys_for_principal_policy(params = {}) ⇒ Types::GetContextKeysForPolicyResponse

Gets a list of all of the context keys referenced in all of the IAM policies attached to the specified IAM entity. The entity can be an IAM user, group, or role. If you specify a user, then the request also includes all of the policies attached to groups that the user is a member of.

You can optionally include a list of one or more additional policies, specified as strings. If you want to include only a list of policies by string, use GetContextKeysForCustomPolicy instead.

Note: This API discloses information about the permissions granted to other users. If you do not want users to see other user's permissions, then consider allowing them to use GetContextKeysForCustomPolicy instead.

Context keys are variables maintained by AWS and its services that provide details about the context of an API query request, and can be evaluated by testing against a value in an IAM policy. Use GetContextKeysForPrincipalPolicy to understand what key names and values you must supply when you call SimulatePrincipalPolicy.

Examples:

Request syntax with placeholder values


resp = client.get_context_keys_for_principal_policy({
  policy_source_arn: "arnType", # required
  policy_input_list: ["policyDocumentType"],
})

Response structure


resp.context_key_names #=> Array
resp.context_key_names[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_source_arn (required, String)

    The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you specify a user, the list includes context keys that are found in all policies attached to the user as well as to all groups that the user is a member of. If you pick a group or a role, then it includes only those context keys that are found in policies attached to that entity. Note that all parameters are shown in unencoded form here for clarity, but must be URL encoded to be included as a part of a real HTML request.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :policy_input_list (Array<String>)

    An optional list of additional policies for which you want the list of context keys that are referenced.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

Returns:

See Also:



3541
3542
3543
3544
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3541

def get_context_keys_for_principal_policy(params = {}, options = {})
  req = build_request(:get_context_keys_for_principal_policy, params)
  req.send_request(options)
end

#get_credential_report(params = {}) ⇒ Types::GetCredentialReportResponse

Retrieves a credential report for the AWS account. For more information about the credential report, see Getting Credential Reports in the IAM User Guide.

Examples:

Response structure


resp.content #=> String
resp.report_format #=> String, one of "text/csv"
resp.generated_time #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



3570
3571
3572
3573
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3570

def get_credential_report(params = {}, options = {})
  req = build_request(:get_credential_report, params)
  req.send_request(options)
end

#get_group(params = {}) ⇒ Types::GetGroupResponse

Returns a list of IAM users that are in the specified IAM group. You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.get_group({
  group_name: "groupNameType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.group.path #=> String
resp.group.group_name #=> String
resp.group.group_id #=> String
resp.group.arn #=> String
resp.group.create_date #=> Time
resp.users #=> Array
resp.users[0].path #=> String
resp.users[0].user_name #=> String
resp.users[0].user_id #=> String
resp.users[0].arn #=> String
resp.users[0].create_date #=> Time
resp.users[0].password_last_used #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



3644
3645
3646
3647
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3644

def get_group(params = {}, options = {})
  req = build_request(:get_group, params)
  req.send_request(options)
end

#get_group_policy(params = {}) ⇒ Types::GetGroupPolicyResponse

Retrieves the specified inline policy document that is embedded in the specified IAM group.

Policies returned by this API are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

An IAM group can also have managed policies attached to it. To retrieve a managed policy document that is attached to a group, use GetPolicy to determine the policy's default version, then use GetPolicyVersion to retrieve the policy document.

For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.get_group_policy({
  group_name: "groupNameType", # required
  policy_name: "policyNameType", # required
})

Response structure


resp.group_name #=> String
resp.policy_name #=> String
resp.policy_document #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group the policy is associated with.

    This parameter allows (per 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: =,.@-

  • :policy_name (required, String)

    The name of the policy document to get.

    This parameter allows (per 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:

See Also:



3720
3721
3722
3723
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3720

def get_group_policy(params = {}, options = {})
  req = build_request(:get_group_policy, params)
  req.send_request(options)
end

#get_instance_profile(params = {}) ⇒ Types::GetInstanceProfileResponse

Retrieves information about the specified instance profile, including the instance profile's path, GUID, ARN, and role. For more information about instance profiles, see About Instance Profiles in the IAM User Guide.

Examples:

Example: To get information about an instance profile


# The following command gets information about the instance profile named ExampleInstanceProfile.

resp = client.get_instance_profile({
  instance_profile_name: "ExampleInstanceProfile", 
})

resp.to_h outputs the following:
{
  instance_profile: {
    arn: "arn:aws:iam::336924118301:instance-profile/ExampleInstanceProfile", 
    create_date: Time.parse("2013-06-12T23:52:02Z"), 
    instance_profile_id: "AID2MAB8DPLSRHEXAMPLE", 
    instance_profile_name: "ExampleInstanceProfile", 
    path: "/", 
    roles: [
      {
        arn: "arn:aws:iam::336924118301:role/Test-Role", 
        assume_role_policy_document: "<URL-encoded-JSON>", 
        create_date: Time.parse("2013-01-09T06:33:26Z"), 
        path: "/", 
        role_id: "AIDGPMS9RO4H3FEXAMPLE", 
        role_name: "Test-Role", 
      }, 
    ], 
  }, 
}

Request syntax with placeholder values


resp = client.get_instance_profile({
  instance_profile_name: "instanceProfileNameType", # required
})

Response structure


resp.instance_profile.path #=> String
resp.instance_profile.instance_profile_name #=> String
resp.instance_profile.instance_profile_id #=> String
resp.instance_profile.arn #=> String
resp.instance_profile.create_date #=> Time
resp.instance_profile.roles #=> Array
resp.instance_profile.roles[0].path #=> String
resp.instance_profile.roles[0].role_name #=> String
resp.instance_profile.roles[0].role_id #=> String
resp.instance_profile.roles[0].arn #=> String
resp.instance_profile.roles[0].create_date #=> Time
resp.instance_profile.roles[0].assume_role_policy_document #=> String
resp.instance_profile.roles[0].description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_profile_name (required, String)

    The name of the instance profile to get information about.

    This parameter allows (per 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:

See Also:



3806
3807
3808
3809
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3806

def get_instance_profile(params = {}, options = {})
  req = build_request(:get_instance_profile, params)
  req.send_request(options)
end

#get_login_profile(params = {}) ⇒ Types::GetLoginProfileResponse

Retrieves the user name and password-creation date for the specified IAM user. If the user has not been assigned a password, the action returns a 404 (NoSuchEntity) error.

Examples:

Example: To get password information for an IAM user


# The following command gets information about the password for the IAM user named Anika.

resp = client.({
  user_name: "Anika", 
})

resp.to_h outputs the following:
{
  login_profile: {
    create_date: Time.parse("2012-09-21T23:03:39Z"), 
    user_name: "Anika", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  user_name: "userNameType", # required
})

Response structure


resp..user_name #=> String
resp..create_date #=> Time
resp..password_reset_required #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user whose login profile you want to retrieve.

    This parameter allows (per 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:

See Also:



3864
3865
3866
3867
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3864

def (params = {}, options = {})
  req = build_request(:get_login_profile, params)
  req.send_request(options)
end

#get_open_id_connect_provider(params = {}) ⇒ Types::GetOpenIDConnectProviderResponse

Returns information about the specified OpenID Connect (OIDC) provider resource object in IAM.

Examples:

Request syntax with placeholder values


resp = client.get_open_id_connect_provider({
  open_id_connect_provider_arn: "arnType", # required
})

Response structure


resp.url #=> String
resp.client_id_list #=> Array
resp.client_id_list[0] #=> String
resp.thumbprint_list #=> Array
resp.thumbprint_list[0] #=> String
resp.create_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :open_id_connect_provider_arn (required, String)

    The Amazon Resource Name (ARN) of the OIDC provider resource object in IAM to get information for. You can get a list of OIDC provider resource ARNs by using the ListOpenIDConnectProviders action.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:

See Also:



3910
3911
3912
3913
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3910

def get_open_id_connect_provider(params = {}, options = {})
  req = build_request(:get_open_id_connect_provider, params)
  req.send_request(options)
end

#get_policy(params = {}) ⇒ Types::GetPolicyResponse

Retrieves information about the specified managed policy, including the policy's default version and the total number of IAM users, groups, and roles to which the policy is attached. To retrieve the list of the specific users, groups, and roles that the policy is attached to, use the ListEntitiesForPolicy API. This API returns metadata about the policy. To retrieve the actual policy document for a specific version of the policy, use GetPolicyVersion.

This API retrieves information about managed policies. To retrieve information about an inline policy that is embedded with an IAM user, group, or role, use the GetUserPolicy, GetGroupPolicy, or GetRolePolicy API.

For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.get_policy({
  policy_arn: "arnType", # required
})

Response structure


resp.policy.policy_name #=> String
resp.policy.policy_id #=> String
resp.policy.arn #=> String
resp.policy.path #=> String
resp.policy.default_version_id #=> String
resp.policy.attachment_count #=> Integer
resp.policy.is_attachable #=> Boolean
resp.policy.description #=> String
resp.policy.create_date #=> Time
resp.policy.update_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

Returns:

See Also:



3973
3974
3975
3976
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 3973

def get_policy(params = {}, options = {})
  req = build_request(:get_policy, params)
  req.send_request(options)
end

#get_policy_version(params = {}) ⇒ Types::GetPolicyVersionResponse

Retrieves information about the specified version of the specified managed policy, including the policy document.

Policies returned by this API are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

To list the available versions for a policy, use ListPolicyVersions.

This API retrieves information about managed policies. To retrieve information about an inline policy that is embedded in a user, group, or role, use the GetUserPolicy, GetGroupPolicy, or GetRolePolicy API.

For more information about the types of policies, see Managed Policies and Inline Policies in the IAM User Guide.

For more information about managed policy versions, see Versioning for Managed Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.get_policy_version({
  policy_arn: "arnType", # required
  version_id: "policyVersionIdType", # required
})

Response structure


resp.policy_version.document #=> String
resp.policy_version.version_id #=> String
resp.policy_version.is_default_version #=> Boolean
resp.policy_version.create_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the managed policy that you want information about.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :version_id (required, String)

    Identifies the policy version to retrieve.

    This parameter allows (per its regex pattern) a string of characters that consists of the lowercase letter 'v' followed by one or two digits, and optionally followed by a period '.' and a string of letters and digits.

Returns:

See Also:



4052
4053
4054
4055
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4052

def get_policy_version(params = {}, options = {})
  req = build_request(:get_policy_version, params)
  req.send_request(options)
end

#get_role(params = {}) ⇒ Types::GetRoleResponse

Retrieves information about the specified role, including the role's path, GUID, ARN, and the role's trust policy that grants permission to assume the role. For more information about roles, see Working with Roles.

Policies returned by this API are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

Examples:

Example: To get information about an IAM role


# The following command gets information about the role named Test-Role.

resp = client.get_role({
  role_name: "Test-Role", 
})

resp.to_h outputs the following:
{
  role: {
    arn: "arn:aws:iam::123456789012:role/Test-Role", 
    assume_role_policy_document: "<URL-encoded-JSON>", 
    create_date: Time.parse("2013-04-18T05:01:58Z"), 
    path: "/", 
    role_id: "AIDIODR4TAW7CSEXAMPLE", 
    role_name: "Test-Role", 
  }, 
}

Request syntax with placeholder values


resp = client.get_role({
  role_name: "roleNameType", # required
})

Response structure


resp.role.path #=> String
resp.role.role_name #=> String
resp.role.role_id #=> String
resp.role.arn #=> String
resp.role.create_date #=> Time
resp.role.assume_role_policy_document #=> String
resp.role.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name of the IAM role to get information about.

    This parameter allows (per 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:

See Also:



4132
4133
4134
4135
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4132

def get_role(params = {}, options = {})
  req = build_request(:get_role, params)
  req.send_request(options)
end

#get_role_policy(params = {}) ⇒ Types::GetRolePolicyResponse

Retrieves the specified inline policy document that is embedded with the specified IAM role.

Policies returned by this API are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

An IAM role can also have managed policies attached to it. To retrieve a managed policy document that is attached to a role, use GetPolicy to determine the policy's default version, then use GetPolicyVersion to retrieve the policy document.

For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

For more information about roles, see Using Roles to Delegate Permissions and Federate Identities.

Examples:

Request syntax with placeholder values


resp = client.get_role_policy({
  role_name: "roleNameType", # required
  policy_name: "policyNameType", # required
})

Response structure


resp.role_name #=> String
resp.policy_name #=> String
resp.policy_document #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name of the role associated with the policy.

    This parameter allows (per 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: _+=,.@-

  • :policy_name (required, String)

    The name of the policy document to get.

    This parameter allows (per 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:

See Also:



4212
4213
4214
4215
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4212

def get_role_policy(params = {}, options = {})
  req = build_request(:get_role_policy, params)
  req.send_request(options)
end

#get_saml_provider(params = {}) ⇒ Types::GetSAMLProviderResponse

Returns the SAML provider metadocument that was uploaded when the IAM SAML provider resource object was created or updated.

This operation requires Signature Version 4.

Examples:

Request syntax with placeholder values


resp = client.get_saml_provider({
  saml_provider_arn: "arnType", # required
})

Response structure


resp. #=> String
resp.create_date #=> Time
resp.valid_until #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

Returns:

See Also:



4261
4262
4263
4264
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4261

def get_saml_provider(params = {}, options = {})
  req = build_request(:get_saml_provider, params)
  req.send_request(options)
end

#get_server_certificate(params = {}) ⇒ Types::GetServerCertificateResponse

Retrieves information about the specified server certificate stored in IAM.

For more information about working with server certificates, including a list of AWS services that can use the server certificates that you manage with IAM, go to Working with Server Certificates in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.get_server_certificate({
  server_certificate_name: "serverCertificateNameType", # required
})

Response structure


resp.server_certificate..path #=> String
resp.server_certificate..server_certificate_name #=> String
resp.server_certificate..server_certificate_id #=> String
resp.server_certificate..arn #=> String
resp.server_certificate..upload_date #=> Time
resp.server_certificate..expiration #=> Time
resp.server_certificate.certificate_body #=> String
resp.server_certificate.certificate_chain #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :server_certificate_name (required, String)

    The name of the server certificate you want to retrieve information about.

    This parameter allows (per 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:

See Also:



4387
4388
4389
4390
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4387

def get_server_certificate(params = {}, options = {})
  req = build_request(:get_server_certificate, params)
  req.send_request(options)
end

#get_ssh_public_key(params = {}) ⇒ Types::GetSSHPublicKeyResponse

Retrieves the specified SSH public key, including metadata about the key.

The SSH public key retrieved by this action is used only for authenticating the associated IAM user to an AWS CodeCommit repository. For more information about using SSH keys to authenticate to an AWS CodeCommit repository, see Set up AWS CodeCommit for SSH Connections in the AWS CodeCommit User Guide.

Examples:

Request syntax with placeholder values


resp = client.get_ssh_public_key({
  user_name: "userNameType", # required
  ssh_public_key_id: "publicKeyIdType", # required
  encoding: "SSH", # required, accepts SSH, PEM
})

Response structure


resp.ssh_public_key.user_name #=> String
resp.ssh_public_key.ssh_public_key_id #=> String
resp.ssh_public_key.fingerprint #=> String
resp.ssh_public_key.ssh_public_key_body #=> String
resp.ssh_public_key.status #=> String, one of "Active", "Inactive"
resp.ssh_public_key.upload_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the IAM user associated with the SSH public key.

    This parameter allows (per 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: =,.@-

  • :ssh_public_key_id (required, String)

    The unique identifier for the SSH public key.

    This parameter allows (per its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.

  • :encoding (required, String)

    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.

Returns:

See Also:



4332
4333
4334
4335
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4332

def get_ssh_public_key(params = {}, options = {})
  req = build_request(:get_ssh_public_key, params)
  req.send_request(options)
end

#get_user(params = {}) ⇒ Types::GetUserResponse

Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN.

If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID used to sign the request to this API.

Examples:

Example: To get information about an IAM user


# The following command gets information about the IAM user named Bob.

resp = client.get_user({
  user_name: "Bob", 
})

resp.to_h outputs the following:
{
  user: {
    arn: "arn:aws:iam::123456789012:user/Bob", 
    create_date: Time.parse("2012-09-21T23:03:13Z"), 
    path: "/", 
    user_id: "AKIAIOSFODNN7EXAMPLE", 
    user_name: "Bob", 
  }, 
}

Request syntax with placeholder values


resp = client.get_user({
  user_name: "existingUserNameType",
})

Response structure


resp.user.path #=> String
resp.user.user_name #=> String
resp.user.user_id #=> String
resp.user.arn #=> String
resp.user.create_date #=> Time
resp.user.password_last_used #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the user to get information about.

    This parameter is optional. If it is not included, it defaults to the user making the request. This parameter allows (per 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:

See Also:



4455
4456
4457
4458
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4455

def get_user(params = {}, options = {})
  req = build_request(:get_user, params)
  req.send_request(options)
end

#get_user_policy(params = {}) ⇒ Types::GetUserPolicyResponse

Retrieves the specified inline policy document that is embedded in the specified IAM user.

Policies returned by this API are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

An IAM user can also have managed policies attached to it. To retrieve a managed policy document that is attached to a user, use GetPolicy to determine the policy's default version, then use GetPolicyVersion to retrieve the policy document.

For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.get_user_policy({
  user_name: "existingUserNameType", # required
  policy_name: "policyNameType", # required
})

Response structure


resp.user_name #=> String
resp.policy_name #=> String
resp.policy_document #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user who the policy is associated with.

    This parameter allows (per 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: =,.@-

  • :policy_name (required, String)

    The name of the policy document to get.

    This parameter allows (per 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:

See Also:



4531
4532
4533
4534
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4531

def get_user_policy(params = {}, options = {})
  req = build_request(:get_user_policy, params)
  req.send_request(options)
end

#list_access_keys(params = {}) ⇒ Types::ListAccessKeysResponse

Returns information about the access key IDs associated with the specified IAM user. If there are none, the action returns an empty list.

Although each user is limited to a small number of keys, you can still paginate the results using the MaxItems and Marker parameters.

If the UserName field is not specified, the UserName is determined implicitly based on the AWS access key ID used to sign the request. Because this action works for access keys under the AWS account, you can use this action to manage root credentials even if the AWS account has no associated users.

To ensure the security of your AWS account, the secret access key is accessible only during key and user creation.

Examples:

Example: To list the access key IDs for an IAM user


# The following command lists the access keys IDs for the IAM user named Alice.

resp = client.list_access_keys({
  user_name: "Alice", 
})

resp.to_h outputs the following:
{
  access_key_metadata: [
    {
      access_key_id: "AKIA111111111EXAMPLE", 
      create_date: Time.parse("2016-12-01T22:19:58Z"), 
      status: "Active", 
      user_name: "Alice", 
    }, 
    {
      access_key_id: "AKIA222222222EXAMPLE", 
      create_date: Time.parse("2016-12-01T22:20:01Z"), 
      status: "Active", 
      user_name: "Alice", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_access_keys({
  user_name: "existingUserNameType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp. #=> Array
resp.[0].user_name #=> String
resp.[0].access_key_id #=> String
resp.[0].status #=> String, one of "Active", "Inactive"
resp.[0].create_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the user.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



4639
4640
4641
4642
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4639

def list_access_keys(params = {}, options = {})
  req = build_request(:list_access_keys, params)
  req.send_request(options)
end

#list_account_aliases(params = {}) ⇒ Types::ListAccountAliasesResponse

Lists the account alias associated with the AWS account (Note: you can have only one). For information about using an AWS account alias, see Using an Alias for Your AWS Account ID in the IAM User Guide.

Examples:

Example: To list account aliases


# The following command lists the aliases for the current account.

resp = client.({
})

resp.to_h outputs the following:
{
  account_aliases: [
    "exmaple-corporation", 
  ], 
}

Request syntax with placeholder values


resp = client.({
  marker: "markerType",
  max_items: 1,
})

Response structure


resp. #=> Array
resp.[0] #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



4709
4710
4711
4712
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4709

def (params = {}, options = {})
  req = build_request(:list_account_aliases, params)
  req.send_request(options)
end

#list_attached_group_policies(params = {}) ⇒ Types::ListAttachedGroupPoliciesResponse

Lists all managed policies that are attached to the specified IAM group.

An IAM group can also have inline policies embedded with it. To list the inline policies for a group, use the ListGroupPolicies API. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

You can paginate the results using the MaxItems and Marker parameters. You can use the PathPrefix parameter to limit the list of policies to only those matching the specified path prefix. If there are no policies attached to the specified group (or none that match the specified path prefix), the action returns an empty list.

Examples:

Request syntax with placeholder values


resp = client.list_attached_group_policies({
  group_name: "groupNameType", # required
  path_prefix: "policyPathType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.attached_policies #=> Array
resp.attached_policies[0].policy_name #=> String
resp.attached_policies[0].policy_arn #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name (friendly name, not ARN) of the group to list attached policies for.

    This parameter allows (per 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: =,.@-

  • :path_prefix (String)

    The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies.

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



4806
4807
4808
4809
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4806

def list_attached_group_policies(params = {}, options = {})
  req = build_request(:list_attached_group_policies, params)
  req.send_request(options)
end

#list_attached_role_policies(params = {}) ⇒ Types::ListAttachedRolePoliciesResponse

Lists all managed policies that are attached to the specified IAM role.

An IAM role can also have inline policies embedded with it. To list the inline policies for a role, use the ListRolePolicies API. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

You can paginate the results using the MaxItems and Marker parameters. You can use the PathPrefix parameter to limit the list of policies to only those matching the specified path prefix. If there are no policies attached to the specified role (or none that match the specified path prefix), the action returns an empty list.

Examples:

Request syntax with placeholder values


resp = client.list_attached_role_policies({
  role_name: "roleNameType", # required
  path_prefix: "policyPathType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.attached_policies #=> Array
resp.attached_policies[0].policy_name #=> String
resp.attached_policies[0].policy_arn #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name (friendly name, not ARN) of the role to list attached policies for.

    This parameter allows (per 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: _+=,.@-

  • :path_prefix (String)

    The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies.

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



4903
4904
4905
4906
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 4903

def list_attached_role_policies(params = {}, options = {})
  req = build_request(:list_attached_role_policies, params)
  req.send_request(options)
end

#list_attached_user_policies(params = {}) ⇒ Types::ListAttachedUserPoliciesResponse

Lists all managed policies that are attached to the specified IAM user.

An IAM user can also have inline policies embedded with it. To list the inline policies for a user, use the ListUserPolicies API. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

You can paginate the results using the MaxItems and Marker parameters. You can use the PathPrefix parameter to limit the list of policies to only those matching the specified path prefix. If there are no policies attached to the specified group (or none that match the specified path prefix), the action returns an empty list.

Examples:

Request syntax with placeholder values


resp = client.list_attached_user_policies({
  user_name: "userNameType", # required
  path_prefix: "policyPathType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.attached_policies #=> Array
resp.attached_policies[0].policy_name #=> String
resp.attached_policies[0].policy_arn #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name (friendly name, not ARN) of the user to list attached policies for.

    This parameter allows (per 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: =,.@-

  • :path_prefix (String)

    The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies.

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5000
5001
5002
5003
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5000

def list_attached_user_policies(params = {}, options = {})
  req = build_request(:list_attached_user_policies, params)
  req.send_request(options)
end

#list_entities_for_policy(params = {}) ⇒ Types::ListEntitiesForPolicyResponse

Lists all IAM users, groups, and roles that the specified managed policy is attached to.

You can use the optional EntityFilter parameter to limit the results to a particular type of entity (users, groups, or roles). For example, to list only the roles that are attached to the specified policy, set EntityFilter to Role.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.list_entities_for_policy({
  policy_arn: "arnType", # required
  entity_filter: "User", # accepts User, Role, Group, LocalManagedPolicy, AWSManagedPolicy
  path_prefix: "pathType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.policy_groups #=> Array
resp.policy_groups[0].group_name #=> String
resp.policy_groups[0].group_id #=> String
resp.policy_users #=> Array
resp.policy_users[0].user_name #=> String
resp.policy_users[0].user_id #=> String
resp.policy_roles #=> Array
resp.policy_roles[0].role_name #=> String
resp.policy_roles[0].role_id #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy for which you want the versions.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :entity_filter (String)

    The entity type to use for filtering the results.

    For example, when EntityFilter is Role, only the roles that are attached to the specified policy are returned. This parameter is optional. If it is not included, all attached entities (users, groups, and roles) are returned. The argument for this parameter must be one of the valid values listed below.

  • :path_prefix (String)

    The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all entities.

    This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5106
5107
5108
5109
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5106

def list_entities_for_policy(params = {}, options = {})
  req = build_request(:list_entities_for_policy, params)
  req.send_request(options)
end

#list_group_policies(params = {}) ⇒ Types::ListGroupPoliciesResponse

Lists the names of the inline policies that are embedded in the specified IAM group.

An IAM group can also have managed policies attached to it. To list the managed policies that are attached to a group, use ListAttachedGroupPolicies. For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

You can paginate the results using the MaxItems and Marker parameters. If there are no inline policies embedded with the specified group, the action returns an empty list.

Examples:

Example: To list the in-line policies for an IAM group


# The following command lists the names of in-line policies that are embedded in the IAM group named Admins.

resp = client.list_group_policies({
  group_name: "Admins", 
})

resp.to_h outputs the following:
{
  policy_names: [
    "AdminRoot", 
    "KeyPolicy", 
  ], 
}

Request syntax with placeholder values


resp = client.list_group_policies({
  group_name: "groupNameType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.policy_names #=> Array
resp.policy_names[0] #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group to list policies for.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5199
5200
5201
5202
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5199

def list_group_policies(params = {}, options = {})
  req = build_request(:list_group_policies, params)
  req.send_request(options)
end

#list_groups(params = {}) ⇒ Types::ListGroupsResponse

Lists the IAM groups that have the specified path prefix.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Example: To list the IAM groups for the current account


# The following command lists the IAM groups in the current account:

resp = client.list_groups({
})

resp.to_h outputs the following:
{
  groups: [
    {
      arn: "arn:aws:iam::123456789012:group/Admins", 
      create_date: Time.parse("2016-12-15T21:40:08.121Z"), 
      group_id: "AGPA1111111111EXAMPLE", 
      group_name: "Admins", 
      path: "/division_abc/subdivision_xyz/", 
    }, 
    {
      arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test", 
      create_date: Time.parse("2016-11-30T14:10:01.156Z"), 
      group_id: "AGP22222222222EXAMPLE", 
      group_name: "Test", 
      path: "/division_abc/subdivision_xyz/product_1234/engineering/", 
    }, 
    {
      arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers", 
      create_date: Time.parse("2016-06-12T20:14:52.032Z"), 
      group_id: "AGPI3333333333EXAMPLE", 
      group_name: "Managers", 
      path: "/division_abc/subdivision_xyz/product_1234/", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_groups({
  path_prefix: "pathPrefixType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.groups #=> Array
resp.groups[0].path #=> String
resp.groups[0].group_name #=> String
resp.groups[0].group_id #=> String
resp.groups[0].arn #=> String
resp.groups[0].create_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path_prefix (String)

    The path prefix for filtering the results. For example, the prefix /division_abc/subdivision_xyz/ gets all groups whose path starts with /division_abc/subdivision_xyz/.

    This parameter is optional. If it is not included, it defaults to a slash (/), listing all groups. This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5308
5309
5310
5311
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5308

def list_groups(params = {}, options = {})
  req = build_request(:list_groups, params)
  req.send_request(options)
end

#list_groups_for_user(params = {}) ⇒ Types::ListGroupsForUserResponse

Lists the IAM groups that the specified IAM user belongs to.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Example: To list the groups that an IAM user belongs to


# The following command displays the groups that the IAM user named Bob belongs to.

resp = client.list_groups_for_user({
  user_name: "Bob", 
})

resp.to_h outputs the following:
{
  groups: [
    {
      arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test", 
      create_date: Time.parse("2016-11-30T14:10:01.156Z"), 
      group_id: "AGP2111111111EXAMPLE", 
      group_name: "Test", 
      path: "/division_abc/subdivision_xyz/product_1234/engineering/", 
    }, 
    {
      arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers", 
      create_date: Time.parse("2016-06-12T20:14:52.032Z"), 
      group_id: "AGPI222222222SEXAMPLE", 
      group_name: "Managers", 
      path: "/division_abc/subdivision_xyz/product_1234/", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_groups_for_user({
  user_name: "existingUserNameType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.groups #=> Array
resp.groups[0].path #=> String
resp.groups[0].group_name #=> String
resp.groups[0].group_id #=> String
resp.groups[0].arn #=> String
resp.groups[0].create_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user to list groups for.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5406
5407
5408
5409
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5406

def list_groups_for_user(params = {}, options = {})
  req = build_request(:list_groups_for_user, params)
  req.send_request(options)
end

#list_instance_profiles(params = {}) ⇒ Types::ListInstanceProfilesResponse

Lists the instance profiles that have the specified path prefix. If there are none, the action returns an empty list. For more information about instance profiles, go to About Instance Profiles.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.list_instance_profiles({
  path_prefix: "pathPrefixType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.instance_profiles #=> Array
resp.instance_profiles[0].path #=> String
resp.instance_profiles[0].instance_profile_name #=> String
resp.instance_profiles[0].instance_profile_id #=> String
resp.instance_profiles[0].arn #=> String
resp.instance_profiles[0].create_date #=> Time
resp.instance_profiles[0].roles #=> Array
resp.instance_profiles[0].roles[0].path #=> String
resp.instance_profiles[0].roles[0].role_name #=> String
resp.instance_profiles[0].roles[0].role_id #=> String
resp.instance_profiles[0].roles[0].arn #=> String
resp.instance_profiles[0].roles[0].create_date #=> Time
resp.instance_profiles[0].roles[0].assume_role_policy_document #=> String
resp.instance_profiles[0].roles[0].description #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path_prefix (String)

    The path prefix for filtering the results. For example, the prefix /application_abc/component_xyz/ gets all instance profiles whose path starts with /application_abc/component_xyz/.

    This parameter is optional. If it is not included, it defaults to a slash (/), listing all instance profiles. This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5494
5495
5496
5497
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5494

def list_instance_profiles(params = {}, options = {})
  req = build_request(:list_instance_profiles, params)
  req.send_request(options)
end

#list_instance_profiles_for_role(params = {}) ⇒ Types::ListInstanceProfilesForRoleResponse

Lists the instance profiles that have the specified associated IAM role. If there are none, the action returns an empty list. For more information about instance profiles, go to About Instance Profiles.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.list_instance_profiles_for_role({
  role_name: "roleNameType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.instance_profiles #=> Array
resp.instance_profiles[0].path #=> String
resp.instance_profiles[0].instance_profile_name #=> String
resp.instance_profiles[0].instance_profile_id #=> String
resp.instance_profiles[0].arn #=> String
resp.instance_profiles[0].create_date #=> Time
resp.instance_profiles[0].roles #=> Array
resp.instance_profiles[0].roles[0].path #=> String
resp.instance_profiles[0].roles[0].role_name #=> String
resp.instance_profiles[0].roles[0].role_id #=> String
resp.instance_profiles[0].roles[0].arn #=> String
resp.instance_profiles[0].roles[0].create_date #=> Time
resp.instance_profiles[0].roles[0].assume_role_policy_document #=> String
resp.instance_profiles[0].roles[0].description #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name of the role to list instance profiles for.

    This parameter allows (per 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: _+=,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5578
5579
5580
5581
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5578

def list_instance_profiles_for_role(params = {}, options = {})
  req = build_request(:list_instance_profiles_for_role, params)
  req.send_request(options)
end

#list_mfa_devices(params = {}) ⇒ Types::ListMFADevicesResponse

Lists the MFA devices for an IAM user. If the request includes a IAM user name, then this action lists all the MFA devices associated with the specified user. If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID signing the request for this API.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.list_mfa_devices({
  user_name: "existingUserNameType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.mfa_devices #=> Array
resp.mfa_devices[0].user_name #=> String
resp.mfa_devices[0].serial_number #=> String
resp.mfa_devices[0].enable_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the user whose MFA devices you want to list.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5649
5650
5651
5652
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5649

def list_mfa_devices(params = {}, options = {})
  req = build_request(:list_mfa_devices, params)
  req.send_request(options)
end

#list_open_id_connect_providers(params = {}) ⇒ Types::ListOpenIDConnectProvidersResponse

Lists information about the IAM OpenID Connect (OIDC) provider resource objects defined in the AWS account.

Examples:

Response structure


resp.open_id_connect_provider_list #=> Array
resp.open_id_connect_provider_list[0].arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



5670
5671
5672
5673
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5670

def list_open_id_connect_providers(params = {}, options = {})
  req = build_request(:list_open_id_connect_providers, params)
  req.send_request(options)
end

#list_policies(params = {}) ⇒ Types::ListPoliciesResponse

Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies.

You can filter the list of policies that is returned using the optional OnlyAttached, Scope, and PathPrefix parameters. For example, to list only the customer managed policies in your AWS account, set Scope to Local. To list only AWS managed policies, set Scope to AWS.

You can paginate the results using the MaxItems and Marker parameters.

For more information about managed policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.list_policies({
  scope: "All", # accepts All, AWS, Local
  only_attached: false,
  path_prefix: "policyPathType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.policies #=> Array
resp.policies[0].policy_name #=> String
resp.policies[0].policy_id #=> String
resp.policies[0].arn #=> String
resp.policies[0].path #=> String
resp.policies[0].default_version_id #=> String
resp.policies[0].attachment_count #=> Integer
resp.policies[0].is_attachable #=> Boolean
resp.policies[0].description #=> String
resp.policies[0].create_date #=> Time
resp.policies[0].update_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :scope (String)

    The scope to use for filtering the results.

    To list only AWS managed policies, set Scope to AWS. To list only the customer managed policies in your AWS account, set Scope to Local.

    This parameter is optional. If it is not included, or if it is set to All, all policies are returned.

  • :only_attached (Boolean)

    A flag to filter the results to only the attached policies.

    When OnlyAttached is true, the returned list contains only the policies that are attached to an IAM user, group, or role. When OnlyAttached is false, or when the parameter is not included, all policies are returned.

  • :path_prefix (String)

    The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies. This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5781
5782
5783
5784
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5781

def list_policies(params = {}, options = {})
  req = build_request(:list_policies, params)
  req.send_request(options)
end

#list_policy_versions(params = {}) ⇒ Types::ListPolicyVersionsResponse

Lists information about the versions of the specified managed policy, including the version that is currently set as the policy's default version.

For more information about managed policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.list_policy_versions({
  policy_arn: "arnType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.versions #=> Array
resp.versions[0].document #=> String
resp.versions[0].version_id #=> String
resp.versions[0].is_default_version #=> Boolean
resp.versions[0].create_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy for which you want the versions.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5854
5855
5856
5857
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5854

def list_policy_versions(params = {}, options = {})
  req = build_request(:list_policy_versions, params)
  req.send_request(options)
end

#list_role_policies(params = {}) ⇒ Types::ListRolePoliciesResponse

Lists the names of the inline policies that are embedded in the specified IAM role.

An IAM role can also have managed policies attached to it. To list the managed policies that are attached to a role, use ListAttachedRolePolicies. For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

You can paginate the results using the MaxItems and Marker parameters. If there are no inline policies embedded with the specified role, the action returns an empty list.

Examples:

Request syntax with placeholder values


resp = client.list_role_policies({
  role_name: "roleNameType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.policy_names #=> Array
resp.policy_names[0] #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name of the role to list policies for.

    This parameter allows (per 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: _+=,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



5930
5931
5932
5933
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 5930

def list_role_policies(params = {}, options = {})
  req = build_request(:list_role_policies, params)
  req.send_request(options)
end

#list_roles(params = {}) ⇒ Types::ListRolesResponse

Lists the IAM roles that have the specified path prefix. If there are none, the action returns an empty list. For more information about roles, go to Working with Roles.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.list_roles({
  path_prefix: "pathPrefixType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.roles #=> Array
resp.roles[0].path #=> String
resp.roles[0].role_name #=> String
resp.roles[0].role_id #=> String
resp.roles[0].arn #=> String
resp.roles[0].create_date #=> Time
resp.roles[0].assume_role_policy_document #=> String
resp.roles[0].description #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path_prefix (String)

    The path prefix for filtering the results. For example, the prefix /application_abc/component_xyz/ gets all roles whose path starts with /application_abc/component_xyz/.

    This parameter is optional. If it is not included, it defaults to a slash (/), listing all roles. This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6012
6013
6014
6015
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6012

def list_roles(params = {}, options = {})
  req = build_request(:list_roles, params)
  req.send_request(options)
end

#list_saml_providers(params = {}) ⇒ Types::ListSAMLProvidersResponse

Lists the SAML provider resource objects defined in IAM in the account.

This operation requires Signature Version 4.

Examples:

Response structure


resp.saml_provider_list #=> Array
resp.saml_provider_list[0].arn #=> String
resp.saml_provider_list[0].valid_until #=> Time
resp.saml_provider_list[0].create_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



6043
6044
6045
6046
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6043

def list_saml_providers(params = {}, options = {})
  req = build_request(:list_saml_providers, params)
  req.send_request(options)
end

#list_server_certificates(params = {}) ⇒ Types::ListServerCertificatesResponse

Lists the server certificates stored in IAM that have the specified path prefix. If none exist, the action returns an empty list.

You can paginate the results using the MaxItems and Marker parameters.

For more information about working with server certificates, including a list of AWS services that can use the server certificates that you manage with IAM, go to Working with Server Certificates in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.list_server_certificates({
  path_prefix: "pathPrefixType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp. #=> Array
resp.[0].path #=> String
resp.[0].server_certificate_name #=> String
resp.[0].server_certificate_id #=> String
resp.[0].arn #=> String
resp.[0].upload_date #=> Time
resp.[0].expiration #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path_prefix (String)

    The path prefix for filtering the results. For example: /company/servercerts would get all server certificates for which the path starts with /company/servercerts.

    This parameter is optional. If it is not included, it defaults to a slash (/), listing all server certificates. This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6210
6211
6212
6213
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6210

def list_server_certificates(params = {}, options = {})
  req = build_request(:list_server_certificates, params)
  req.send_request(options)
end

#list_service_specific_credentials(params = {}) ⇒ Types::ListServiceSpecificCredentialsResponse

Returns information about the service-specific credentials associated with the specified IAM user. If there are none, the action returns an empty list. The service-specific credentials returned by this action are used only for authenticating the IAM user to a specific service. For more information about using service-specific credentials to authenticate to an AWS service, see Set Up service-specific credentials in the AWS CodeCommit User Guide.

Examples:

Request syntax with placeholder values


resp = client.list_service_specific_credentials({
  user_name: "userNameType",
  service_name: "serviceName",
})

Response structure


resp.service_specific_credentials #=> Array
resp.service_specific_credentials[0].user_name #=> String
resp.service_specific_credentials[0].status #=> String, one of "Active", "Inactive"
resp.service_specific_credentials[0].service_user_name #=> String
resp.service_specific_credentials[0].create_date #=> Time
resp.service_specific_credentials[0].service_specific_credential_id #=> String
resp.service_specific_credentials[0].service_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the user whose service-specific credentials you want information about. If this value is not specified then the operation assumes the user whose credentials are used to call the operation.

    This parameter allows (per 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: =,.@-

  • :service_name (String)

    Filters the returned results to only those for the specified AWS service. If not specified, then AWS returns service-specific credentials for all services.

Returns:

See Also:



6271
6272
6273
6274
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6271

def list_service_specific_credentials(params = {}, options = {})
  req = build_request(:list_service_specific_credentials, params)
  req.send_request(options)
end

#list_signing_certificates(params = {}) ⇒ Types::ListSigningCertificatesResponse

Returns information about the signing certificates associated with the specified IAM user. If there are none, the action returns an empty list.

Although each user is limited to a small number of signing certificates, you can still paginate the results using the MaxItems and Marker parameters.

If the UserName field is not specified, the user name is determined implicitly based on the AWS access key ID used to sign the request for this API. Because this action works for access keys under the AWS account, you can use this action to manage root credentials even if the AWS account has no associated users.

Examples:

Example: To list the signing certificates for an IAM user


# The following command lists the signing certificates for the IAM user named Bob.

resp = client.list_signing_certificates({
  user_name: "Bob", 
})

resp.to_h outputs the following:
{
  certificates: [
    {
      certificate_body: "-----BEGIN CERTIFICATE-----<certificate-body>-----END CERTIFICATE-----", 
      certificate_id: "TA7SMP42TDN5Z26OBPJE7EXAMPLE", 
      status: "Active", 
      upload_date: Time.parse("2013-06-06T21:40:08Z"), 
      user_name: "Bob", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_signing_certificates({
  user_name: "existingUserNameType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.certificates #=> Array
resp.certificates[0].user_name #=> String
resp.certificates[0].certificate_id #=> String
resp.certificates[0].certificate_body #=> String
resp.certificates[0].status #=> String, one of "Active", "Inactive"
resp.certificates[0].upload_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the IAM user whose signing certificates you want to examine.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6372
6373
6374
6375
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6372

def list_signing_certificates(params = {}, options = {})
  req = build_request(:list_signing_certificates, params)
  req.send_request(options)
end

#list_ssh_public_keys(params = {}) ⇒ Types::ListSSHPublicKeysResponse

Returns information about the SSH public keys associated with the specified IAM user. If there are none, the action returns an empty list.

The SSH public keys returned by this action are used only for authenticating the IAM user to an AWS CodeCommit repository. For more information about using SSH keys to authenticate to an AWS CodeCommit repository, see Set up AWS CodeCommit for SSH Connections in the AWS CodeCommit User Guide.

Although each user is limited to a small number of keys, you can still paginate the results using the MaxItems and Marker parameters.

Examples:

Request syntax with placeholder values


resp = client.list_ssh_public_keys({
  user_name: "userNameType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.ssh_public_keys #=> Array
resp.ssh_public_keys[0].user_name #=> String
resp.ssh_public_keys[0].ssh_public_key_id #=> String
resp.ssh_public_keys[0].status #=> String, one of "Active", "Inactive"
resp.ssh_public_keys[0].upload_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the IAM user to list SSH public keys for. If none is specified, the UserName field is determined implicitly based on the AWS access key used to sign the request.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6125
6126
6127
6128
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6125

def list_ssh_public_keys(params = {}, options = {})
  req = build_request(:list_ssh_public_keys, params)
  req.send_request(options)
end

#list_user_policies(params = {}) ⇒ Types::ListUserPoliciesResponse

Lists the names of the inline policies embedded in the specified IAM user.

An IAM user can also have managed policies attached to it. To list the managed policies that are attached to a user, use ListAttachedUserPolicies. For more information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

You can paginate the results using the MaxItems and Marker parameters. If there are no inline policies embedded with the specified user, the action returns an empty list.

Examples:

Request syntax with placeholder values


resp = client.list_user_policies({
  user_name: "existingUserNameType", # required
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.policy_names #=> Array
resp.policy_names[0] #=> String
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user to list policies for.

    This parameter allows (per 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: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6448
6449
6450
6451
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6448

def list_user_policies(params = {}, options = {})
  req = build_request(:list_user_policies, params)
  req.send_request(options)
end

#list_users(params = {}) ⇒ Types::ListUsersResponse

Lists the IAM users that have the specified path prefix. If no path prefix is specified, the action returns all users in the AWS account. If there are none, the action returns an empty list.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Example: To list IAM users


# The following command lists the IAM users in the current account.

resp = client.list_users({
})

resp.to_h outputs the following:
{
  users: [
    {
      arn: "arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/engineering/Juan", 
      create_date: Time.parse("2012-09-05T19:38:48Z"), 
      password_last_used: Time.parse("2016-09-08T21:47:36Z"), 
      path: "/division_abc/subdivision_xyz/engineering/", 
      user_id: "AID2MAB8DPLSRHEXAMPLE", 
      user_name: "Juan", 
    }, 
    {
      arn: "arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/engineering/Anika", 
      create_date: Time.parse("2014-04-09T15:43:45Z"), 
      password_last_used: Time.parse("2016-09-24T16:18:07Z"), 
      path: "/division_abc/subdivision_xyz/engineering/", 
      user_id: "AIDIODR4TAW7CSEXAMPLE", 
      user_name: "Anika", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_users({
  path_prefix: "pathPrefixType",
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.users #=> Array
resp.users[0].path #=> String
resp.users[0].user_name #=> String
resp.users[0].user_id #=> String
resp.users[0].arn #=> String
resp.users[0].create_date #=> Time
resp.users[0].password_last_used #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :path_prefix (String)

    The path prefix for filtering the results. For example: /division_abc/subdivision_xyz/, which would get all user names whose path starts with /division_abc/subdivision_xyz/.

    This parameter is optional. If it is not included, it defaults to a slash (/), listing all user names. This paramater allows (per its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes, containing any ASCII character from the ! (\u0021) thru the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6555
6556
6557
6558
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6555

def list_users(params = {}, options = {})
  req = build_request(:list_users, params)
  req.send_request(options)
end

#list_virtual_mfa_devices(params = {}) ⇒ Types::ListVirtualMFADevicesResponse

Lists the virtual MFA devices defined in the AWS account by assignment status. If you do not specify an assignment status, the action returns a list of all virtual MFA devices. Assignment status can be Assigned, Unassigned, or Any.

You can paginate the results using the MaxItems and Marker parameters.

Examples:

Example: To list virtual MFA devices


# The following command lists the virtual MFA devices that have been configured for the current account.

resp = client.list_virtual_mfa_devices({
})

resp.to_h outputs the following:
{
  virtual_mfa_devices: [
    {
      serial_number: "arn:aws:iam::123456789012:mfa/ExampleMFADevice", 
    }, 
    {
      serial_number: "arn:aws:iam::123456789012:mfa/Juan", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_virtual_mfa_devices({
  assignment_status: "Assigned", # accepts Assigned, Unassigned, Any
  marker: "markerType",
  max_items: 1,
})

Response structure


resp.virtual_mfa_devices #=> Array
resp.virtual_mfa_devices[0].serial_number #=> String
resp.virtual_mfa_devices[0].base_32_string_seed #=> String
resp.virtual_mfa_devices[0].qr_code_png #=> String
resp.virtual_mfa_devices[0].user.path #=> String
resp.virtual_mfa_devices[0].user.user_name #=> String
resp.virtual_mfa_devices[0].user.user_id #=> String
resp.virtual_mfa_devices[0].user.arn #=> String
resp.virtual_mfa_devices[0].user.create_date #=> Time
resp.virtual_mfa_devices[0].user.password_last_used #=> Time
resp.virtual_mfa_devices[0].enable_date #=> Time
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :assignment_status (String)

    The status (Unassigned or Assigned) of the devices to list. If you do not specify an AssignmentStatus, the action defaults to Any which lists both assigned and unassigned virtual MFA devices.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:



6645
6646
6647
6648
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6645

def list_virtual_mfa_devices(params = {}, options = {})
  req = build_request(:list_virtual_mfa_devices, params)
  req.send_request(options)
end

#put_group_policy(params = {}) ⇒ Struct

Adds or updates an inline policy document that is embedded in the specified IAM group.

A user can also have managed policies attached to it. To attach a managed policy to a group, use AttachGroupPolicy. To create a new managed policy, use CreatePolicy. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

For information about limits on the number of inline policies that you can embed in a group, see Limitations on IAM Entities in the IAM User Guide.

Because policy documents can be large, you should use POST rather than GET when calling PutGroupPolicy. For general information about using the Query API with IAM, go to Making Query Requests in the IAM User Guide.

Examples:

Example: To add a policy to a group


# The following command adds a policy named AllPerms to the IAM group named Admins.

resp = client.put_group_policy({
  group_name: "Admins", 
  policy_document: "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Action\":\"*\",\"Resource\":\"*\"}}", 
  policy_name: "AllPerms", 
})

Request syntax with placeholder values


resp = client.put_group_policy({
  group_name: "groupNameType", # required
  policy_name: "policyNameType", # required
  policy_document: "policyDocumentType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group to associate the policy with.

    This parameter allows (per 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: =,.@-

  • :policy_name (required, String)

    The name of the policy document.

    This parameter allows (per 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: =,.@-

  • :policy_document (required, String)

    The policy document.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6739
6740
6741
6742
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6739

def put_group_policy(params = {}, options = {})
  req = build_request(:put_group_policy, params)
  req.send_request(options)
end

#put_role_policy(params = {}) ⇒ Struct

Adds or updates an inline policy document that is embedded in the specified IAM role.

When you embed an inline policy in a role, the inline policy is used as part of the role's access (permissions) policy. The role's trust policy is created at the same time as the role, using CreateRole. You can update a role's trust policy using UpdateAssumeRolePolicy. For more information about IAM roles, go to Using Roles to Delegate Permissions and Federate Identities.

A role can also have a managed policy attached to it. To attach a managed policy to a role, use AttachRolePolicy. To create a new managed policy, use CreatePolicy. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

For information about limits on the number of inline policies that you can embed with a role, see Limitations on IAM Entities in the IAM User Guide.

Because policy documents can be large, you should use POST rather than GET when calling PutRolePolicy. For general information about using the Query API with IAM, go to Making Query Requests in the IAM User Guide.

Examples:

Example: To attach a permissions policy to an IAM role


# The following command adds a permissions policy to the role named Test-Role.

resp = client.put_role_policy({
  policy_document: "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}}", 
  policy_name: "S3AccessPolicy", 
  role_name: "S3Access", 
})

Request syntax with placeholder values


resp = client.put_role_policy({
  role_name: "roleNameType", # required
  policy_name: "policyNameType", # required
  policy_document: "policyDocumentType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :role_name (required, String)

    The name of the role to associate the policy with.

    This parameter allows (per 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: _+=,.@-

  • :policy_name (required, String)

    The name of the policy document.

    This parameter allows (per 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: =,.@-

  • :policy_document (required, String)

    The policy document.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6841
6842
6843
6844
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6841

def put_role_policy(params = {}, options = {})
  req = build_request(:put_role_policy, params)
  req.send_request(options)
end

#put_user_policy(params = {}) ⇒ Struct

Adds or updates an inline policy document that is embedded in the specified IAM user.

An IAM user can also have a managed policy attached to it. To attach a managed policy to a user, use AttachUserPolicy. To create a new managed policy, use CreatePolicy. For information about policies, see Managed Policies and Inline Policies in the IAM User Guide.

For information about limits on the number of inline policies that you can embed in a user, see Limitations on IAM Entities in the IAM User Guide.

Because policy documents can be large, you should use POST rather than GET when calling PutUserPolicy. For general information about using the Query API with IAM, go to Making Query Requests in the IAM User Guide.

Examples:

Example: To attach a policy to an IAM user


# The following command attaches a policy to the IAM user named Bob.

resp = client.put_user_policy({
  policy_document: "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Action\":\"*\",\"Resource\":\"*\"}}", 
  policy_name: "AllAccessPolicy", 
  user_name: "Bob", 
})

Request syntax with placeholder values


resp = client.put_user_policy({
  user_name: "existingUserNameType", # required
  policy_name: "policyNameType", # required
  policy_document: "policyDocumentType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user to associate the policy with.

    This parameter allows (per 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: =,.@-

  • :policy_name (required, String)

    The name of the policy document.

    This parameter allows (per 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: =,.@-

  • :policy_document (required, String)

    The policy document.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6935
6936
6937
6938
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6935

def put_user_policy(params = {}, options = {})
  req = build_request(:put_user_policy, params)
  req.send_request(options)
end

#remove_client_id_from_open_id_connect_provider(params = {}) ⇒ Struct

Removes the specified client ID (also known as audience) from the list of client IDs registered for the specified IAM OpenID Connect (OIDC) provider resource object.

This action is idempotent; it does not fail or return an error if you try to remove a client ID that does not exist.

Examples:

Request syntax with placeholder values


resp = client.remove_client_id_from_open_id_connect_provider({
  open_id_connect_provider_arn: "arnType", # required
  client_id: "clientIDType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :open_id_connect_provider_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM OIDC provider resource to remove the client ID from. You can get a list of OIDC provider ARNs by using the ListOpenIDConnectProviders action.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :client_id (required, String)

    The client ID (also known as audience) to remove from the IAM OIDC provider resource. For more information about client IDs, see CreateOpenIDConnectProvider.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6977
6978
6979
6980
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 6977

def remove_client_id_from_open_id_connect_provider(params = {}, options = {})
  req = build_request(:remove_client_id_from_open_id_connect_provider, params)
  req.send_request(options)
end

#remove_role_from_instance_profile(params = {}) ⇒ Struct

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

Make sure 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:

Example: To remove a role from an instance profile


# The following command removes the role named Test-Role from the instance profile named ExampleInstanceProfile.

resp = client.remove_role_from_instance_profile({
  instance_profile_name: "ExampleInstanceProfile", 
  role_name: "Test-Role", 
})

Request syntax with placeholder values


resp = client.remove_role_from_instance_profile({
  instance_profile_name: "instanceProfileNameType", # required
  role_name: "roleNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_profile_name (required, String)

    The name of the instance profile to update.

    This parameter allows (per 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: =,.@-

  • :role_name (required, String)

    The name of the role to remove.

    This parameter allows (per 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:



7046
7047
7048
7049
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 7046

def remove_role_from_instance_profile(params = {}, options = {})
  req = build_request(:remove_role_from_instance_profile, params)
  req.send_request(options)
end

#remove_user_from_group(params = {}) ⇒ Struct

Removes the specified user from the specified group.

Examples:

Example: To remove a user from an IAM group


# The following command removes the user named Bob from the IAM group named Admins.

resp = client.remove_user_from_group({
  group_name: "Admins", 
  user_name: "Bob", 
})

Request syntax with placeholder values


resp = client.remove_user_from_group({
  group_name: "groupNameType", # required
  user_name: "existingUserNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group to update.

    This parameter allows (per 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: =,.@-

  • :user_name (required, String)

    The name of the user to remove.

    This parameter allows (per 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:



7100
7101
7102
7103
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 7100

def remove_user_from_group(params = {}, options = {})
  req = build_request(:remove_user_from_group, params)
  req.send_request(options)
end

#reset_service_specific_credential(params = {}) ⇒ Types::ResetServiceSpecificCredentialResponse

Resets the password for a service-specific credential. The new password is AWS generated and cryptographically strong. It cannot be configured by the user. Resetting the password immediately invalidates the previous password associated with this user.

Examples:

Request syntax with placeholder values


resp = client.reset_service_specific_credential({
  user_name: "userNameType",
  service_specific_credential_id: "serviceSpecificCredentialId", # required
})

Response structure


resp.service_specific_credential.create_date #=> Time
resp.service_specific_credential.service_name #=> String
resp.service_specific_credential.service_user_name #=> String
resp.service_specific_credential.service_password #=> String
resp.service_specific_credential.service_specific_credential_id #=> String
resp.service_specific_credential.user_name #=> String
resp.service_specific_credential.status #=> String, one of "Active", "Inactive"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (String)

    The name of the IAM user associated with the service-specific credential. If this value is not specified, then the operation assumes the user whose credentials are used to call the operation.

    This parameter allows (per 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: =,.@-

  • :service_specific_credential_id (required, String)

    The unique identifier of the service-specific credential.

    This parameter allows (per its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.

Returns:

See Also:



7160
7161
7162
7163
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 7160

def reset_service_specific_credential(params = {}, options = {})
  req = build_request(:reset_service_specific_credential, params)
  req.send_request(options)
end

#resync_mfa_device(params = {}) ⇒ Struct

Synchronizes the specified MFA device with its IAM resource object on the AWS servers.

For more information about creating and working with virtual MFA devices, go to Using a Virtual MFA Device in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.resync_mfa_device({
  user_name: "existingUserNameType", # required
  serial_number: "serialNumberType", # required
  authentication_code_1: "authenticationCodeType", # required
  authentication_code_2: "authenticationCodeType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_name (required, String)

    The name of the user whose MFA device you want to resynchronize.

    This parameter allows (per 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: =,.@-

  • :serial_number (required, String)

    Serial number that uniquely identifies the MFA device.

    This parameter allows (per 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: =,.@-

  • :authentication_code_1 (required, String)

    An authentication code emitted by the device.

    The format for this parameter is a sequence of six digits.

  • :authentication_code_2 (required, String)

    A subsequent authentication code emitted by the device.

    The format for this parameter is a sequence of six digits.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



7225
7226
7227
7228
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 7225

def resync_mfa_device(params = {}, options = {})
  req = build_request(:resync_mfa_device, params)
  req.send_request(options)
end

#set_default_policy_version(params = {}) ⇒ Struct

Sets the specified version of the specified policy as the policy's default (operative) version.

This action affects all users, groups, and roles that the policy is attached to. To list the users, groups, and roles that the policy is attached to, use the ListEntitiesForPolicy API.

For information about managed policies, see Managed Policies and Inline Policies in the IAM User Guide.

Examples:

Request syntax with placeholder values


resp = client.set_default_policy_version({
  policy_arn: "arnType", # required
  version_id: "policyVersionIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_arn (required, String)

    The Amazon Resource Name (ARN) of the IAM policy whose default version you want to set.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :version_id (required, String)

    The version of the policy to set as the default (operative) version.

    For more information about managed policy versions, see Versioning for Managed Policies in the IAM User Guide.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



7278
7279
7280
7281
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 7278

def set_default_policy_version(params = {}, options = {})
  req = build_request(:set_default_policy_version, params)
  req.send_request(options)
end

#simulate_custom_policy(params = {}) ⇒ Types::SimulatePolicyResponse

Simulate how a set of IAM policies and optionally a resource-based policy works with a list of API actions and AWS resources to determine the policies' effective permissions. The policies are provided as strings.

The simulation does not perform the API actions; it only checks the authorization to determine if the simulated policies allow or deny the actions.

If you want to simulate existing policies attached to an IAM user, group, or role, use SimulatePrincipalPolicy instead.

Context keys are variables maintained by AWS and its services that provide details about the context of an API query request. You can use the Condition element of an IAM policy to evaluate context keys. To get the list of context keys that the policies require for correct simulation, use GetContextKeysForCustomPolicy.

If the output is long, you can use MaxItems and Marker parameters to paginate the results.

Examples:

Request syntax with placeholder values


resp = client.simulate_custom_policy({
  policy_input_list: ["policyDocumentType"], # required
  action_names: ["ActionNameType"], # required
  resource_arns: ["ResourceNameType"],
  resource_policy: "policyDocumentType",
  resource_owner: "ResourceNameType",
  caller_arn: "ResourceNameType",
  context_entries: [
    {
      context_key_name: "ContextKeyNameType",
      context_key_values: ["ContextKeyValueType"],
      context_key_type: "string", # accepts string, stringList, numeric, numericList, boolean, booleanList, ip, ipList, binary, binaryList, date, dateList
    },
  ],
  resource_handling_option: "ResourceHandlingOptionType",
  max_items: 1,
  marker: "markerType",
})

Response structure


resp.evaluation_results #=> Array
resp.evaluation_results[0].eval_action_name #=> String
resp.evaluation_results[0].eval_resource_name #=> String
resp.evaluation_results[0].eval_decision #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.evaluation_results[0].matched_statements #=> Array
resp.evaluation_results[0].matched_statements[0].source_policy_id #=> String
resp.evaluation_results[0].matched_statements[0].source_policy_type #=> String, one of "user", "group", "role", "aws-managed", "user-managed", "resource", "none"
resp.evaluation_results[0].matched_statements[0].start_position.line #=> Integer
resp.evaluation_results[0].matched_statements[0].start_position.column #=> Integer
resp.evaluation_results[0].matched_statements[0].end_position.line #=> Integer
resp.evaluation_results[0].matched_statements[0].end_position.column #=> Integer
resp.evaluation_results[0].missing_context_values #=> Array
resp.evaluation_results[0].missing_context_values[0] #=> String
resp.evaluation_results[0].organizations_decision_detail.allowed_by_organizations #=> Boolean
resp.evaluation_results[0].eval_decision_details #=> Hash
resp.evaluation_results[0].eval_decision_details["EvalDecisionSourceType"] #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.evaluation_results[0].resource_specific_results #=> Array
resp.evaluation_results[0].resource_specific_results[0].eval_resource_name #=> String
resp.evaluation_results[0].resource_specific_results[0].eval_resource_decision #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.evaluation_results[0].resource_specific_results[0].matched_statements #=> Array
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].source_policy_id #=> String
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].source_policy_type #=> String, one of "user", "group", "role", "aws-managed", "user-managed", "resource", "none"
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].start_position.line #=> Integer
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].start_position.column #=> Integer
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].end_position.line #=> Integer
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].end_position.column #=> Integer
resp.evaluation_results[0].resource_specific_results[0].missing_context_values #=> Array
resp.evaluation_results[0].resource_specific_results[0].missing_context_values[0] #=> String
resp.evaluation_results[0].resource_specific_results[0].eval_decision_details #=> Hash
resp.evaluation_results[0].resource_specific_results[0].eval_decision_details["EvalDecisionSourceType"] #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_input_list (required, Array<String>)

    A list of policy documents to include in the simulation. Each document is specified as a string containing the complete, valid JSON text of an IAM policy. Do not include any resource-based policies in this parameter. Any resource-based policy must be submitted with the ResourcePolicy parameter. The policies cannot be "scope-down" policies, such as you could include in a call to GetFederationToken or one of the AssumeRole APIs to restrict what a user can do while using the temporary credentials.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :action_names (required, Array<String>)

    A list of names of API actions to evaluate in the simulation. Each action is evaluated against each resource. Each action must include the service identifier, such as iam:CreateUser.

  • :resource_arns (Array<String>)

    A list of ARNs of AWS resources to include in the simulation. If this parameter is not provided then the value defaults to * (all resources). Each API in the ActionNames parameter is evaluated for each resource in this list. The simulation determines the access result (allowed or denied) of each combination and reports it in the response.

    The simulation does not automatically retrieve policies for the specified resources. If you want to include a resource policy in the simulation, then you must include the policy as a string in the ResourcePolicy parameter.

    If you include a ResourcePolicy, then it must be applicable to all of the resources included in the simulation or you receive an invalid input error.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :resource_policy (String)

    A resource-based policy to include in the simulation provided as a string. Each resource in the simulation is treated as if it had this policy attached. You can include only one resource-based policy in a simulation.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :resource_owner (String)

    An AWS account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN, such as an S3 bucket or object. If ResourceOwner is specified, it is also used as the account owner of any ResourcePolicy included in the simulation. If the ResourceOwner parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided in CallerArn. This parameter is required only if you specify a resource-based policy and account that owns the resource is different from the account that owns the simulated calling user CallerArn.

  • :caller_arn (String)

    The ARN of the IAM user that you want to use as the simulated caller of the APIs. CallerArn is required if you include a ResourcePolicy so that the policy's Principal element has a value to use in evaluating the policy.

    You can specify only the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated user, or a service principal.

  • :context_entries (Array<Types::ContextEntry>)

    A list of context keys and corresponding values for the simulation to use. Whenever a context key is evaluated in one of the simulated IAM permission policies, the corresponding value is supplied.

  • :resource_handling_option (String)

    Specifies the type of simulation to run. Different APIs that support resource-based policies require different combinations of resources. By specifying the type of simulation to run, you enable the policy simulator to enforce the presence of the required resources to ensure reliable simulation results. If your simulation does not match one of the following scenarios, then you can omit this parameter. The following list shows each of the supported scenario values and the resources that you must define to run the simulation.

    Each of the EC2 scenarios requires that you specify instance, image, and security-group resources. If your scenario includes an EBS volume, then you must specify that volume as a resource. If the EC2 scenario includes VPC, then you must supply the network-interface resource. If it includes an IP subnet, then you must specify the subnet resource. For more information on the EC2 scenario options, see Supported Platforms in the AWS EC2 User Guide.

    • EC2-Classic-InstanceStore

      instance, image, security-group

    • EC2-Classic-EBS

      instance, image, security-group, volume

    • EC2-VPC-InstanceStore

      instance, image, security-group, network-interface

    • EC2-VPC-InstanceStore-Subnet

      instance, image, security-group, network-interface, subnet

    • EC2-VPC-EBS

      instance, image, security-group, network-interface, volume

    • EC2-VPC-EBS-Subnet

      instance, image, security-group, network-interface, subnet, volume

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

Returns:

See Also:



7531
7532
7533
7534
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/client.rb', line 7531

def simulate_custom_policy(params = {}, options = {})
  req = build_request(:simulate_custom_policy, params)
  req.send_request(options)
end

#simulate_principal_policy(params = {}) ⇒ Types::SimulatePolicyResponse

Simulate how a set of IAM policies attached to an IAM entity works with a list of API actions and AWS resources to determine the policies' effective permissions. The entity can be an IAM user, group, or role. If you specify a user, then the simulation also includes all of the policies that are attached to groups that the user belongs to .

You can optionally include a list of one or more additional policies specified as strings to include in the simulation. If you want to simulate only policies specified as strings, use SimulateCustomPolicy instead.

You can also optionally include one resource-based policy to be evaluated with each of the resources included in the simulation.

The simulation does not perform the API actions, it only checks the authorization to determine if the simulated policies allow or deny the actions.

Note: This API discloses information about the permissions granted to other users. If you do not want users to see other user's permissions, then consider allowing them to use SimulateCustomPolicy instead.

Context keys are variables maintained by AWS and its services that provide details about the context of an API query request. You can use the Condition element of an IAM policy to evaluate context keys. To get the list of context keys that the policies require for correct simulation, use GetContextKeysForPrincipalPolicy.

If the output is long, you can use the MaxItems and Marker parameters to paginate the results.

Examples:

Request syntax with placeholder values


resp = client.simulate_principal_policy({
  policy_source_arn: "arnType", # required
  policy_input_list: ["policyDocumentType"],
  action_names: ["ActionNameType"], # required
  resource_arns: ["ResourceNameType"],
  resource_policy: "policyDocumentType",
  resource_owner: "ResourceNameType",
  caller_arn: "ResourceNameType",
  context_entries: [
    {
      context_key_name: "ContextKeyNameType",
      context_key_values: ["ContextKeyValueType"],
      context_key_type: "string", # accepts string, stringList, numeric, numericList, boolean, booleanList, ip, ipList, binary, binaryList, date, dateList
    },
  ],
  resource_handling_option: "ResourceHandlingOptionType",
  max_items: 1,
  marker: "markerType",
})

Response structure


resp.evaluation_results #=> Array
resp.evaluation_results[0].eval_action_name #=> String
resp.evaluation_results[0].eval_resource_name #=> String
resp.evaluation_results[0].eval_decision #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.evaluation_results[0].matched_statements #=> Array
resp.evaluation_results[0].matched_statements[0].source_policy_id #=> String
resp.evaluation_results[0].matched_statements[0].source_policy_type #=> String, one of "user", "group", "role", "aws-managed", "user-managed", "resource", "none"
resp.evaluation_results[0].matched_statements[0].start_position.line #=> Integer
resp.evaluation_results[0].matched_statements[0].start_position.column #=> Integer
resp.evaluation_results[0].matched_statements[0].end_position.line #=> Integer
resp.evaluation_results[0].matched_statements[0].end_position.column #=> Integer
resp.evaluation_results[0].missing_context_values #=> Array
resp.evaluation_results[0].missing_context_values[0] #=> String
resp.evaluation_results[0].organizations_decision_detail.allowed_by_organizations #=> Boolean
resp.evaluation_results[0].eval_decision_details #=> Hash
resp.evaluation_results[0].eval_decision_details["EvalDecisionSourceType"] #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.evaluation_results[0].resource_specific_results #=> Array
resp.evaluation_results[0].resource_specific_results[0].eval_resource_name #=> String
resp.evaluation_results[0].resource_specific_results[0].eval_resource_decision #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.evaluation_results[0].resource_specific_results[0].matched_statements #=> Array
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].source_policy_id #=> String
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].source_policy_type #=> String, one of "user", "group", "role", "aws-managed", "user-managed", "resource", "none"
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].start_position.line #=> Integer
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].start_position.column #=> Integer
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].end_position.line #=> Integer
resp.evaluation_results[0].resource_specific_results[0].matched_statements[0].end_position.column #=> Integer
resp.evaluation_results[0].resource_specific_results[0].missing_context_values #=> Array
resp.evaluation_results[0].resource_specific_results[0].missing_context_values[0] #=> String
resp.evaluation_results[0].resource_specific_results[0].eval_decision_details #=> Hash
resp.evaluation_results[0].resource_specific_results[0].eval_decision_details["EvalDecisionSourceType"] #=> String, one of "allowed", "explicitDeny", "implicitDeny"
resp.is_truncated #=> Boolean
resp.marker #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_source_arn (required, String)

    The Amazon Resource Name (ARN) of a user, group, or role whose policies you want to include in the simulation. If you specify a user, group, or role, the simulation includes all policies that are associated with that entity. If you specify a user, the simulation also includes all policies that are attached to any groups the user belongs to.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :policy_input_list (Array<String>)

    An optional list of additional policy documents to include in the simulation. Each document is specified as a string containing the complete, valid JSON text of an IAM policy.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :action_names (required, Array<String>)

    A list of names of API actions to evaluate in the simulation. Each action is evaluated for each resource. Each action must include the service identifier, such as iam:CreateUser.

  • :resource_arns (Array<String>)

    A list of ARNs of AWS resources to include in the simulation. If this parameter is not provided then the value defaults to * (all resources). Each API in the ActionNames parameter is evaluated for each resource in this list. The simulation determines the access result (allowed or denied) of each combination and reports it in the response.

    The simulation does not automatically retrieve policies for the specified resources. If you want to include a resource policy in the simulation, then you must include the policy as a string in the ResourcePolicy parameter.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :resource_policy (String)

    A resource-based policy to include in the simulation provided as a string. Each resource in the simulation is treated as if it had this policy attached. You can include only one resource-based policy in a simulation.

    The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (\u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF). It also includes the special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D).

  • :resource_owner (String)

    An AWS account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN, such as an S3 bucket or object. If ResourceOwner is specified, it is also used as the account owner of any ResourcePolicy included in the simulation. If the ResourceOwner parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided in CallerArn. This parameter is required only if you specify a resource-based policy and account that owns the resource is different from the account that owns the simulated calling user CallerArn.

  • :caller_arn (String)

    The ARN of the IAM user that you want to specify as the simulated caller of the APIs. If you do not specify a CallerArn, it defaults to the ARN of the user that you specify in PolicySourceArn, if you specified a user. If you include both a PolicySourceArn (for example, arn:aws:iam::123456789012:user/David) and a CallerArn (for example, arn:aws:iam::123456789012:user/Bob), the result is that you simulate calling the APIs as Bob, as if Bob had David's policies.

    You can specify only the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated user, or a service principal.

    CallerArn is required if you include a ResourcePolicy and the PolicySourceArn is not the ARN for an IAM user. This is required so that the resource-based policy's Principal element has a value to use in evaluating the policy.

    For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

  • :context_entries (Array<Types::ContextEntry>)

    A list of context keys and corresponding values for the simulation to use. Whenever a context key is evaluated in one of the simulated IAM permission policies, the corresponding value is supplied.

  • :resource_handling_option (String)

    Specifies the type of simulation to run. Different APIs that support resource-based policies require different