AWS Identity and Access Management (IAM) is a web service that you can use to manage users and user permissions under your AWS account. This guide provides descriptions of IAM actions that you can call programmatically. For general information about IAM, see AWS Identity and Access Management (IAM). For the user guide for IAM, see Using IAM.
AWS provides SDKs that consist of libraries and sample code for various programming languages and platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to IAM and AWS. For example, the SDKs take care of tasks such as cryptographically signing requests (see below), managing errors, and retrying requests automatically. For information about the AWS SDKs, including how to download and install them, see the Tools for Amazon Web Services page.
We recommend that you use the AWS SDKs to make programmatic API calls to IAM. However, you can also use the IAM Query API to make direct calls to the IAM web service. To learn more about the IAM Query API, see Making Query Requests in the Using IAM guide. IAM supports GET and POST requests for all actions. That is, the API does not require you to use GET for some actions and POST for others. However, GET requests are subject to the limitation size of a URL. Therefore, for operations that require larger sizes, use a POST request.
Signing Requests
Requests must be signed using an access key ID and a secret access key. We strongly recommend that you do not use your AWS account access key ID and secret access key for everyday work with IAM. You can use the access key ID and secret access key for an IAM user or you can use the AWS Security Token Service to generate temporary security credentials and use those to sign requests.
To sign requests, we recommend that you use Signature Version 4. If you have an existing application that uses Signature Version 2, you do not have to update it to use Signature Version 4. However, some operations now require Signature Version 4. The documentation for operations that require version 4 indicate this requirement.
Additional Resources
For more information, see the following:
AWS Security Credentials. This topic provides general information about the types of credentials used for accessing AWS.
IAM Best Practices. This topic presents a list of suggestions for using the IAM service to help secure your AWS resources.
Signing AWS API Requests. This set of topics walk you through the process of signing a request using an access key ID and secret access key.
iam()
add_client_id_to_open_id_connect_provider | 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 |
add_role_to_instance_profile | Adds the specified IAM role to the specified instance profile |
add_user_to_group | Adds the specified user to the specified group |
attach_group_policy | Attaches the specified managed policy to the specified IAM group |
attach_role_policy | Attaches the specified managed policy to the specified IAM role |
attach_user_policy | Attaches the specified managed policy to the specified user |
change_password | Changes the password of the IAM user who is calling this operation |
create_access_key | Creates a new AWS secret access key and corresponding AWS access key ID for the specified user |
create_account_alias | Creates an alias for your AWS account |
create_group | Creates a new group |
create_instance_profile | Creates a new instance profile |
create_login_profile | Creates a password for the specified user, giving the user the ability to access AWS services through the AWS Management Console |
create_open_id_connect_provider | Creates an IAM entity to describe an identity provider (IdP) that supports OpenID Connect (OIDC) |
create_policy | Creates a new managed policy for your AWS account |
create_policy_version | Creates a new version of the specified managed policy |
create_role | Creates a new role for your AWS account |
create_saml_provider | Creates an IAM resource that describes an identity provider (IdP) that supports SAML 2 |
create_service_linked_role | Creates an IAM role that is linked to a specific AWS service |
create_service_specific_credential | Generates a set of credentials consisting of a user name and password that can be used to access the service specified in the request |
create_user | Creates a new IAM user for your AWS account |
create_virtual_mfa_device | Creates a new virtual MFA device for the AWS account |
deactivate_mfa_device | Deactivates the specified MFA device and removes it from association with the user name for which it was originally enabled |
delete_access_key | Deletes the access key pair associated with the specified IAM user |
delete_account_alias | Deletes the specified AWS account alias |
delete_account_password_policy | Deletes the password policy for the AWS account |
delete_group | Deletes the specified IAM group |
delete_group_policy | Deletes the specified inline policy that is embedded in the specified IAM group |
delete_instance_profile | Deletes the specified instance profile |
delete_login_profile | Deletes the password for the specified IAM user, which terminates the user's ability to access AWS services through the AWS Management Console |
delete_open_id_connect_provider | Deletes an OpenID Connect identity provider (IdP) resource object in IAM |
delete_policy | Deletes the specified managed policy |
delete_policy_version | Deletes the specified version from the specified managed policy |
delete_role | Deletes the specified role |
delete_role_permissions_boundary | Deletes the permissions boundary for the specified IAM role |
delete_role_policy | Deletes the specified inline policy that is embedded in the specified IAM role |
delete_saml_provider | Deletes a SAML provider resource in IAM |
delete_ssh_public_key | Deletes the specified SSH public key |
delete_server_certificate | Deletes the specified server certificate |
delete_service_linked_role | Submits a service-linked role deletion request and returns a DeletionTaskId, which you can use to check the status of the deletion |
delete_service_specific_credential | Deletes the specified service-specific credential |
delete_signing_certificate | Deletes a signing certificate associated with the specified IAM user |
delete_user | Deletes the specified IAM user |
delete_user_permissions_boundary | Deletes the permissions boundary for the specified IAM user |
delete_user_policy | Deletes the specified inline policy that is embedded in the specified IAM user |
delete_virtual_mfa_device | Deletes a virtual MFA device |
detach_group_policy | Removes the specified managed policy from the specified IAM group |
detach_role_policy | Removes the specified managed policy from the specified role |
detach_user_policy | Removes the specified managed policy from the specified user |
enable_mfa_device | Enables the specified MFA device and associates it with the specified IAM user |
generate_credential_report | Generates a credential report for the AWS account |
generate_service_last_accessed_details | Generates a request for a report that includes details about when an IAM resource (user, group, role, or policy) was last used in an attempt to access AWS services |
get_access_key_last_used | Retrieves information about when the specified access key was last used |
get_account_authorization_details | Retrieves information about all IAM users, groups, roles, and policies in your AWS account, including their relationships to one another |
get_account_password_policy | Retrieves the password policy for the AWS account |
get_account_summary | Retrieves information about IAM entity usage and IAM quotas in the AWS account |
get_context_keys_for_custom_policy | Gets a list of all of the context keys referenced in the input policies |
get_context_keys_for_principal_policy | Gets a list of all of the context keys referenced in all the IAM policies that are attached to the specified IAM entity |
get_credential_report | Retrieves a credential report for the AWS account |
get_group | Returns a list of IAM users that are in the specified IAM group |
get_group_policy | Retrieves the specified inline policy document that is embedded in the specified IAM group |
get_instance_profile | Retrieves information about the specified instance profile, including the instance profile's path, GUID, ARN, and role |
get_login_profile | Retrieves the user name and password-creation date for the specified IAM user |
get_open_id_connect_provider | Returns information about the specified OpenID Connect (OIDC) provider resource object in IAM |
get_policy | 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 |
get_policy_version | Retrieves information about the specified version of the specified managed policy, including the policy document |
get_role | 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 |
get_role_policy | Retrieves the specified inline policy document that is embedded with the specified IAM role |
get_saml_provider | Returns the SAML provider metadocument that was uploaded when the IAM SAML provider resource object was created or updated |
get_ssh_public_key | Retrieves the specified SSH public key, including metadata about the key |
get_server_certificate | Retrieves information about the specified server certificate stored in IAM |
get_service_last_accessed_details | After you generate a user, group, role, or policy report using the GenerateServiceLastAccessedDetails operation, you can use the JobId parameter in GetServiceLastAccessedDetails |
get_service_last_accessed_details_with_entities | After you generate a group or policy report using the GenerateServiceLastAccessedDetails operation, you can use the JobId parameter in GetServiceLastAccessedDetailsWithEntities |
get_service_linked_role_deletion_status | Retrieves the status of your service-linked role deletion |
get_user | Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN |
get_user_policy | Retrieves the specified inline policy document that is embedded in the specified IAM user |
list_access_keys | Returns information about the access key IDs associated with the specified IAM user |
list_account_aliases | Lists the account alias associated with the AWS account (Note: you can have only one) |
list_attached_group_policies | Lists all managed policies that are attached to the specified IAM group |
list_attached_role_policies | Lists all managed policies that are attached to the specified IAM role |
list_attached_user_policies | Lists all managed policies that are attached to the specified IAM user |
list_entities_for_policy | Lists all IAM users, groups, and roles that the specified managed policy is attached to |
list_group_policies | Lists the names of the inline policies that are embedded in the specified IAM group |
list_groups | Lists the IAM groups that have the specified path prefix |
list_groups_for_user | Lists the IAM groups that the specified IAM user belongs to |
list_instance_profiles | Lists the instance profiles that have the specified path prefix |
list_instance_profiles_for_role | Lists the instance profiles that have the specified associated IAM role |
list_mfa_devices | Lists the MFA devices for an IAM user |
list_open_id_connect_providers | Lists information about the IAM OpenID Connect (OIDC) provider resource objects defined in the AWS account |
list_policies | Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies |
list_policies_granting_service_access | Retrieves a list of policies that the IAM identity (user, group, or role) can use to access each specified service |
list_policy_versions | Lists information about the versions of the specified managed policy, including the version that is currently set as the policy's default version |
list_role_policies | Lists the names of the inline policies that are embedded in the specified IAM role |
list_role_tags | Lists the tags that are attached to the specified role |
list_roles | Lists the IAM roles that have the specified path prefix |
list_saml_providers | Lists the SAML provider resource objects defined in IAM in the account |
list_ssh_public_keys | Returns information about the SSH public keys associated with the specified IAM user |
list_server_certificates | Lists the server certificates stored in IAM that have the specified path prefix |
list_service_specific_credentials | Returns information about the service-specific credentials associated with the specified IAM user |
list_signing_certificates | Returns information about the signing certificates associated with the specified IAM user |
list_user_policies | Lists the names of the inline policies embedded in the specified IAM user |
list_user_tags | Lists the tags that are attached to the specified user |
list_users | Lists the IAM users that have the specified path prefix |
list_virtual_mfa_devices | Lists the virtual MFA devices defined in the AWS account by assignment status |
put_group_policy | Adds or updates an inline policy document that is embedded in the specified IAM group |
put_role_permissions_boundary | Adds or updates the policy that is specified as the IAM role's permissions boundary |
put_role_policy | Adds or updates an inline policy document that is embedded in the specified IAM role |
put_user_permissions_boundary | Adds or updates the policy that is specified as the IAM user's permissions boundary |
put_user_policy | Adds or updates an inline policy document that is embedded in the specified IAM user |
remove_client_id_from_open_id_connect_provider | 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 |
remove_role_from_instance_profile | Removes the specified IAM role from the specified EC2 instance profile |
remove_user_from_group | Removes the specified user from the specified group |
reset_service_specific_credential | Resets the password for a service-specific credential |
resync_mfa_device | Synchronizes the specified MFA device with its IAM resource object on the AWS servers |
set_default_policy_version | Sets the specified version of the specified policy as the policy's default (operative) version |
simulate_custom_policy | Simulate how a set of IAM policies and optionally a resource-based policy works with a list of API operations and AWS resources to determine the policies' effective permissions |
simulate_principal_policy | Simulate how a set of IAM policies attached to an IAM entity works with a list of API operations and AWS resources to determine the policies' effective permissions |
tag_role | Adds one or more tags to an IAM role |
tag_user | Adds one or more tags to an IAM user |
untag_role | Removes the specified tags from the role |
untag_user | Removes the specified tags from the user |
update_access_key | Changes the status of the specified access key from Active to Inactive, or vice versa |
update_account_password_policy | Updates the password policy settings for the AWS account |
update_assume_role_policy | Updates the policy that grants an IAM entity permission to assume a role |
update_group | Updates the name and/or the path of the specified IAM group |
update_login_profile | Changes the password for the specified IAM user |
update_open_id_connect_provider_thumbprint | Replaces the existing list of server certificate thumbprints associated with an OpenID Connect (OIDC) provider resource object with a new list of thumbprints |
update_role | Updates the description or maximum session duration setting of a role |
update_role_description | Use UpdateRole instead |
update_saml_provider | Updates the metadata document for an existing SAML provider resource object |
update_ssh_public_key | Sets the status of an IAM user's SSH public key to active or inactive |
update_server_certificate | Updates the name and/or the path of the specified server certificate stored in IAM |
update_service_specific_credential | Sets the status of a service-specific credential to Active or Inactive |
update_signing_certificate | Changes the status of the specified user signing certificate from active to disabled, or vice versa |
update_user | Updates the name and/or the path of the specified IAM user |
upload_ssh_public_key | Uploads an SSH public key and associates it with the specified IAM user |
upload_server_certificate | Uploads a server certificate entity for the AWS account |
# NOT RUN {
# 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:
# }
# NOT RUN {
svc <- iam()
svc$add_client_id_to_open_id_connect_provider(
ClientID = "my-application-ID",
OpenIDConnectProviderArn = "arn:aws:iam::123456789012:oidc-provider/server.example.com"
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab