AWS Identity and Access Management 2010-05-08
- Client: Aws\Iam\IamClient
- Service ID: iam
- Version: 2010-05-08
This page describes the parameters and results for the operations of the AWS Identity and Access Management (2010-05-08), and shows how to use the Aws\Iam\IamClient object to call the described operations. This documentation is specific to the 2010-05-08 API version of the service.
Operation Summary
Each of the following operations can be created from a client using
$client->getCommand('CommandName')
, where "CommandName" is the
name of one of the following operations. Note: a command is a value that
encapsulates an operation and the parameters used to create an HTTP request.
You can also create and send a command immediately using the magic methods
available on a client object: $client->commandName(/* parameters */)
.
You can send the command asynchronously (returning a promise) by appending the
word "Async" to the operation name: $client->commandNameAsync(/* parameters */)
.
- AddClientIDToOpenIDConnectProvider ( array $params = [] )
- 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.
- AddRoleToInstanceProfile ( array $params = [] )
- Adds the specified IAM role to the specified instance profile.
- AddUserToGroup ( array $params = [] )
- Adds the specified user to the specified group.
- AttachGroupPolicy ( array $params = [] )
- Attaches the specified managed policy to the specified IAM group.
- AttachRolePolicy ( array $params = [] )
- Attaches the specified managed policy to the specified IAM role.
- AttachUserPolicy ( array $params = [] )
- Attaches the specified managed policy to the specified user.
- ChangePassword ( array $params = [] )
- Changes the password of the IAM user who is calling this operation.
- CreateAccessKey ( array $params = [] )
- Creates a new Amazon Web Services secret access key and corresponding Amazon Web Services access key ID for the specified user.
- CreateAccountAlias ( array $params = [] )
- Creates an alias for your Amazon Web Services account.
- CreateGroup ( array $params = [] )
- Creates a new group.
- CreateInstanceProfile ( array $params = [] )
- Creates a new instance profile.
- CreateLoginProfile ( array $params = [] )
- Creates a password for the specified IAM user.
- CreateOpenIDConnectProvider ( array $params = [] )
- Creates an IAM entity to describe an identity provider (IdP) that supports OpenID Connect (OIDC).
- CreatePolicy ( array $params = [] )
- Creates a new managed policy for your Amazon Web Services account.
- CreatePolicyVersion ( array $params = [] )
- Creates a new version of the specified managed policy.
- CreateRole ( array $params = [] )
- Creates a new role for your Amazon Web Services account.
- CreateSAMLProvider ( array $params = [] )
- Creates an IAM resource that describes an identity provider (IdP) that supports SAML 2.
- CreateServiceLinkedRole ( array $params = [] )
- Creates an IAM role that is linked to a specific Amazon Web Services service.
- CreateServiceSpecificCredential ( array $params = [] )
- Generates a set of credentials consisting of a user name and password that can be used to access the service specified in the request.
- CreateUser ( array $params = [] )
- Creates a new IAM user for your Amazon Web Services account.
- CreateVirtualMFADevice ( array $params = [] )
- Creates a new virtual MFA device for the Amazon Web Services account.
- DeactivateMFADevice ( array $params = [] )
- Deactivates the specified MFA device and removes it from association with the user name for which it was originally enabled.
- DeleteAccessKey ( array $params = [] )
- Deletes the access key pair associated with the specified IAM user.
- DeleteAccountAlias ( array $params = [] )
- Deletes the specified Amazon Web Services account alias.
- DeleteAccountPasswordPolicy ( array $params = [] )
- Deletes the password policy for the Amazon Web Services account.
- DeleteGroup ( array $params = [] )
- Deletes the specified IAM group.
- DeleteGroupPolicy ( array $params = [] )
- Deletes the specified inline policy that is embedded in the specified IAM group.
- DeleteInstanceProfile ( array $params = [] )
- Deletes the specified instance profile.
- DeleteLoginProfile ( array $params = [] )
- Deletes the password for the specified IAM user, For more information, see Managing passwords for IAM users.
- DeleteOpenIDConnectProvider ( array $params = [] )
- Deletes an OpenID Connect identity provider (IdP) resource object in IAM.
- DeletePolicy ( array $params = [] )
- Deletes the specified managed policy.
- DeletePolicyVersion ( array $params = [] )
- Deletes the specified version from the specified managed policy.
- DeleteRole ( array $params = [] )
- Deletes the specified role.
- DeleteRolePermissionsBoundary ( array $params = [] )
- Deletes the permissions boundary for the specified IAM role.
- DeleteRolePolicy ( array $params = [] )
- Deletes the specified inline policy that is embedded in the specified IAM role.
- DeleteSAMLProvider ( array $params = [] )
- Deletes a SAML provider resource in IAM.
- DeleteSSHPublicKey ( array $params = [] )
- Deletes the specified SSH public key.
- DeleteServerCertificate ( array $params = [] )
- Deletes the specified server certificate.
- DeleteServiceLinkedRole ( array $params = [] )
- Submits a service-linked role deletion request and returns a DeletionTaskId, which you can use to check the status of the deletion.
- DeleteServiceSpecificCredential ( array $params = [] )
- Deletes the specified service-specific credential.
- DeleteSigningCertificate ( array $params = [] )
- Deletes a signing certificate associated with the specified IAM user.
- DeleteUser ( array $params = [] )
- Deletes the specified IAM user.
- DeleteUserPermissionsBoundary ( array $params = [] )
- Deletes the permissions boundary for the specified IAM user.
- DeleteUserPolicy ( array $params = [] )
- Deletes the specified inline policy that is embedded in the specified IAM user.
- DeleteVirtualMFADevice ( array $params = [] )
- Deletes a virtual MFA device.
- DetachGroupPolicy ( array $params = [] )
- Removes the specified managed policy from the specified IAM group.
- DetachRolePolicy ( array $params = [] )
- Removes the specified managed policy from the specified role.
- DetachUserPolicy ( array $params = [] )
- Removes the specified managed policy from the specified user.
- EnableMFADevice ( array $params = [] )
- Enables the specified MFA device and associates it with the specified IAM user.
- GenerateCredentialReport ( array $params = [] )
- Generates a credential report for the Amazon Web Services account.
- GenerateOrganizationsAccessReport ( array $params = [] )
- Generates a report for service last accessed data for Organizations.
- GenerateServiceLastAccessedDetails ( array $params = [] )
- Generates a report that includes details about when an IAM resource (user, group, role, or policy) was last used in an attempt to access Amazon Web Services services.
- GetAccessKeyLastUsed ( array $params = [] )
- Retrieves information about when the specified access key was last used.
- GetAccountAuthorizationDetails ( array $params = [] )
- Retrieves information about all IAM users, groups, roles, and policies in your Amazon Web Services account, including their relationships to one another.
- GetAccountPasswordPolicy ( array $params = [] )
- Retrieves the password policy for the Amazon Web Services account.
- GetAccountSummary ( array $params = [] )
- Retrieves information about IAM entity usage and IAM quotas in the Amazon Web Services account.
- GetContextKeysForCustomPolicy ( array $params = [] )
- Gets a list of all of the context keys referenced in the input policies.
- GetContextKeysForPrincipalPolicy ( array $params = [] )
- Gets a list of all of the context keys referenced in all the IAM policies that are attached to the specified IAM entity.
- GetCredentialReport ( array $params = [] )
- Retrieves a credential report for the Amazon Web Services account.
- GetGroup ( array $params = [] )
- Returns a list of IAM users that are in the specified IAM group.
- GetGroupPolicy ( array $params = [] )
- Retrieves the specified inline policy document that is embedded in the specified IAM group.
- GetInstanceProfile ( array $params = [] )
- Retrieves information about the specified instance profile, including the instance profile's path, GUID, ARN, and role.
- GetLoginProfile ( array $params = [] )
- Retrieves the user name for the specified IAM user.
- GetMFADevice ( array $params = [] )
- Retrieves information about an MFA device for a specified user.
- GetOpenIDConnectProvider ( array $params = [] )
- Returns information about the specified OpenID Connect (OIDC) provider resource object in IAM.
- GetOrganizationsAccessReport ( array $params = [] )
- Retrieves the service last accessed data report for Organizations that was previously generated using the GenerateOrganizationsAccessReport operation.
- GetPolicy ( array $params = [] )
- 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.
- GetPolicyVersion ( array $params = [] )
- Retrieves information about the specified version of the specified managed policy, including the policy document.
- GetRole ( array $params = [] )
- 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.
- GetRolePolicy ( array $params = [] )
- Retrieves the specified inline policy document that is embedded with the specified IAM role.
- GetSAMLProvider ( array $params = [] )
- Returns the SAML provider metadocument that was uploaded when the IAM SAML provider resource object was created or updated.
- GetSSHPublicKey ( array $params = [] )
- Retrieves the specified SSH public key, including metadata about the key.
- GetServerCertificate ( array $params = [] )
- Retrieves information about the specified server certificate stored in IAM.
- GetServiceLastAccessedDetails ( array $params = [] )
- Retrieves a service last accessed report that was created using the GenerateServiceLastAccessedDetails operation.
- GetServiceLastAccessedDetailsWithEntities ( array $params = [] )
- After you generate a group or policy report using the GenerateServiceLastAccessedDetails operation, you can use the JobId parameter in GetServiceLastAccessedDetailsWithEntities.
- GetServiceLinkedRoleDeletionStatus ( array $params = [] )
- Retrieves the status of your service-linked role deletion.
- GetUser ( array $params = [] )
- Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN.
- GetUserPolicy ( array $params = [] )
- Retrieves the specified inline policy document that is embedded in the specified IAM user.
- ListAccessKeys ( array $params = [] )
- Returns information about the access key IDs associated with the specified IAM user.
- ListAccountAliases ( array $params = [] )
- Lists the account alias associated with the Amazon Web Services account (Note: you can have only one).
- ListAttachedGroupPolicies ( array $params = [] )
- Lists all managed policies that are attached to the specified IAM group.
- ListAttachedRolePolicies ( array $params = [] )
- Lists all managed policies that are attached to the specified IAM role.
- ListAttachedUserPolicies ( array $params = [] )
- Lists all managed policies that are attached to the specified IAM user.
- ListEntitiesForPolicy ( array $params = [] )
- Lists all IAM users, groups, and roles that the specified managed policy is attached to.
- ListGroupPolicies ( array $params = [] )
- Lists the names of the inline policies that are embedded in the specified IAM group.
- ListGroups ( array $params = [] )
- Lists the IAM groups that have the specified path prefix.
- ListGroupsForUser ( array $params = [] )
- Lists the IAM groups that the specified IAM user belongs to.
- ListInstanceProfileTags ( array $params = [] )
- Lists the tags that are attached to the specified IAM instance profile.
- ListInstanceProfiles ( array $params = [] )
- Lists the instance profiles that have the specified path prefix.
- ListInstanceProfilesForRole ( array $params = [] )
- Lists the instance profiles that have the specified associated IAM role.
- ListMFADeviceTags ( array $params = [] )
- Lists the tags that are attached to the specified IAM virtual multi-factor authentication (MFA) device.
- ListMFADevices ( array $params = [] )
- Lists the MFA devices for an IAM user.
- ListOpenIDConnectProviderTags ( array $params = [] )
- Lists the tags that are attached to the specified OpenID Connect (OIDC)-compatible identity provider.
- ListOpenIDConnectProviders ( array $params = [] )
- Lists information about the IAM OpenID Connect (OIDC) provider resource objects defined in the Amazon Web Services account.
- ListPolicies ( array $params = [] )
- Lists all the managed policies that are available in your Amazon Web Services account, including your own customer-defined managed policies and all Amazon Web Services managed policies.
- ListPoliciesGrantingServiceAccess ( array $params = [] )
- Retrieves a list of policies that the IAM identity (user, group, or role) can use to access each specified service.
- ListPolicyTags ( array $params = [] )
- Lists the tags that are attached to the specified IAM customer managed policy.
- ListPolicyVersions ( array $params = [] )
- Lists information about the versions of the specified managed policy, including the version that is currently set as the policy's default version.
- ListRolePolicies ( array $params = [] )
- Lists the names of the inline policies that are embedded in the specified IAM role.
- ListRoleTags ( array $params = [] )
- Lists the tags that are attached to the specified role.
- ListRoles ( array $params = [] )
- Lists the IAM roles that have the specified path prefix.
- ListSAMLProviderTags ( array $params = [] )
- Lists the tags that are attached to the specified Security Assertion Markup Language (SAML) identity provider.
- ListSAMLProviders ( array $params = [] )
- Lists the SAML provider resource objects defined in IAM in the account.
- ListSSHPublicKeys ( array $params = [] )
- Returns information about the SSH public keys associated with the specified IAM user.
- ListServerCertificateTags ( array $params = [] )
- Lists the tags that are attached to the specified IAM server certificate.
- ListServerCertificates ( array $params = [] )
- Lists the server certificates stored in IAM that have the specified path prefix.
- ListServiceSpecificCredentials ( array $params = [] )
- Returns information about the service-specific credentials associated with the specified IAM user.
- ListSigningCertificates ( array $params = [] )
- Returns information about the signing certificates associated with the specified IAM user.
- ListUserPolicies ( array $params = [] )
- Lists the names of the inline policies embedded in the specified IAM user.
- ListUserTags ( array $params = [] )
- Lists the tags that are attached to the specified IAM user.
- ListUsers ( array $params = [] )
- Lists the IAM users that have the specified path prefix.
- ListVirtualMFADevices ( array $params = [] )
- Lists the virtual MFA devices defined in the Amazon Web Services account by assignment status.
- PutGroupPolicy ( array $params = [] )
- Adds or updates an inline policy document that is embedded in the specified IAM group.
- PutRolePermissionsBoundary ( array $params = [] )
- Adds or updates the policy that is specified as the IAM role's permissions boundary.
- PutRolePolicy ( array $params = [] )
- Adds or updates an inline policy document that is embedded in the specified IAM role.
- PutUserPermissionsBoundary ( array $params = [] )
- Adds or updates the policy that is specified as the IAM user's permissions boundary.
- PutUserPolicy ( array $params = [] )
- Adds or updates an inline policy document that is embedded in the specified IAM user.
- RemoveClientIDFromOpenIDConnectProvider ( array $params = [] )
- 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.
- RemoveRoleFromInstanceProfile ( array $params = [] )
- Removes the specified IAM role from the specified Amazon EC2 instance profile.
- RemoveUserFromGroup ( array $params = [] )
- Removes the specified user from the specified group.
- ResetServiceSpecificCredential ( array $params = [] )
- Resets the password for a service-specific credential.
- ResyncMFADevice ( array $params = [] )
- Synchronizes the specified MFA device with its IAM resource object on the Amazon Web Services servers.
- SetDefaultPolicyVersion ( array $params = [] )
- Sets the specified version of the specified policy as the policy's default (operative) version.
- SetSecurityTokenServicePreferences ( array $params = [] )
- Sets the specified version of the global endpoint token as the token version used for the Amazon Web Services account.
- SimulateCustomPolicy ( array $params = [] )
- Simulate how a set of IAM policies and optionally a resource-based policy works with a list of API operations and Amazon Web Services resources to determine the policies' effective permissions.
- SimulatePrincipalPolicy ( array $params = [] )
- Simulate how a set of IAM policies attached to an IAM entity works with a list of API operations and Amazon Web Services resources to determine the policies' effective permissions.
- TagInstanceProfile ( array $params = [] )
- Adds one or more tags to an IAM instance profile.
- TagMFADevice ( array $params = [] )
- Adds one or more tags to an IAM virtual multi-factor authentication (MFA) device.
- TagOpenIDConnectProvider ( array $params = [] )
- Adds one or more tags to an OpenID Connect (OIDC)-compatible identity provider.
- TagPolicy ( array $params = [] )
- Adds one or more tags to an IAM customer managed policy.
- TagRole ( array $params = [] )
- Adds one or more tags to an IAM role.
- TagSAMLProvider ( array $params = [] )
- Adds one or more tags to a Security Assertion Markup Language (SAML) identity provider.
- TagServerCertificate ( array $params = [] )
- Adds one or more tags to an IAM server certificate.
- TagUser ( array $params = [] )
- Adds one or more tags to an IAM user.
- UntagInstanceProfile ( array $params = [] )
- Removes the specified tags from the IAM instance profile.
- UntagMFADevice ( array $params = [] )
- Removes the specified tags from the IAM virtual multi-factor authentication (MFA) device.
- UntagOpenIDConnectProvider ( array $params = [] )
- Removes the specified tags from the specified OpenID Connect (OIDC)-compatible identity provider in IAM.
- UntagPolicy ( array $params = [] )
- Removes the specified tags from the customer managed policy.
- UntagRole ( array $params = [] )
- Removes the specified tags from the role.
- UntagSAMLProvider ( array $params = [] )
- Removes the specified tags from the specified Security Assertion Markup Language (SAML) identity provider in IAM.
- UntagServerCertificate ( array $params = [] )
- Removes the specified tags from the IAM server certificate.
- UntagUser ( array $params = [] )
- Removes the specified tags from the user.
- UpdateAccessKey ( array $params = [] )
- Changes the status of the specified access key from Active to Inactive, or vice versa.
- UpdateAccountPasswordPolicy ( array $params = [] )
- Updates the password policy settings for the Amazon Web Services account.
- UpdateAssumeRolePolicy ( array $params = [] )
- Updates the policy that grants an IAM entity permission to assume a role.
- UpdateGroup ( array $params = [] )
- Updates the name and/or the path of the specified IAM group.
- UpdateLoginProfile ( array $params = [] )
- Changes the password for the specified IAM user.
- UpdateOpenIDConnectProviderThumbprint ( array $params = [] )
- Replaces the existing list of server certificate thumbprints associated with an OpenID Connect (OIDC) provider resource object with a new list of thumbprints.
- UpdateRole ( array $params = [] )
- Updates the description or maximum session duration setting of a role.
- UpdateRoleDescription ( array $params = [] )
- Use UpdateRole instead.
- UpdateSAMLProvider ( array $params = [] )
- Updates the metadata document for an existing SAML provider resource object.
- UpdateSSHPublicKey ( array $params = [] )
- Sets the status of an IAM user's SSH public key to active or inactive.
- UpdateServerCertificate ( array $params = [] )
- Updates the name and/or the path of the specified server certificate stored in IAM.
- UpdateServiceSpecificCredential ( array $params = [] )
- Sets the status of a service-specific credential to Active or Inactive.
- UpdateSigningCertificate ( array $params = [] )
- Changes the status of the specified user signing certificate from active to disabled, or vice versa.
- UpdateUser ( array $params = [] )
- Updates the name and/or the path of the specified IAM user.
- UploadSSHPublicKey ( array $params = [] )
- Uploads an SSH public key and associates it with the specified IAM user.
- UploadServerCertificate ( array $params = [] )
- Uploads a server certificate entity for the Amazon Web Services account.
- UploadSigningCertificate ( array $params = [] )
- Uploads an X.
Paginators
Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:
- GetAccountAuthorizationDetails
- GetGroup
- ListAccessKeys
- ListAccountAliases
- ListAttachedGroupPolicies
- ListAttachedRolePolicies
- ListAttachedUserPolicies
- ListEntitiesForPolicy
- ListGroupPolicies
- ListGroups
- ListGroupsForUser
- ListInstanceProfileTags
- ListInstanceProfiles
- ListInstanceProfilesForRole
- ListMFADeviceTags
- ListMFADevices
- ListOpenIDConnectProviderTags
- ListPolicies
- ListPolicyTags
- ListPolicyVersions
- ListRolePolicies
- ListRoleTags
- ListRoles
- ListSAMLProviderTags
- ListSAMLProviders
- ListSSHPublicKeys
- ListServerCertificateTags
- ListServerCertificates
- ListSigningCertificates
- ListUserPolicies
- ListUserTags
- ListUsers
- ListVirtualMFADevices
- SimulateCustomPolicy
- SimulatePrincipalPolicy
Waiters
Waiters allow you to poll a resource until it enters into a desired state. A waiter has a name used to describe what it does, and is associated with an API operation. When creating a waiter, you can provide the API operation parameters associated with the corresponding operation. Waiters can be accessed using the getWaiter($waiterName, $operationParameters) method of a client object. This client supports the following waiters:
Waiter name | API Operation | Delay | Max Attempts |
---|---|---|---|
InstanceProfileExists | GetInstanceProfile | 1 | 40 |
UserExists | GetUser | 1 | 20 |
RoleExists | GetRole | 1 | 20 |
PolicyExists | GetPolicy | 1 | 20 |
Operations
AddClientIDToOpenIDConnectProvider
$result = $client->addClientIDToOpenIDConnectProvider
([/* ... */]); $promise = $client->addClientIDToOpenIDConnectProviderAsync
([/* ... */]);
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 operation is idempotent; it does not fail or return an error if you add an existing client ID to the provider.
Parameter Syntax
$result = $client->addClientIDToOpenIDConnectProvider([ 'ClientID' => '<string>', // REQUIRED 'OpenIDConnectProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- ClientID
-
- Required: Yes
- Type: string
The client ID (also known as audience) to add to the IAM OpenID Connect provider resource.
- OpenIDConnectProviderArn
-
- Required: Yes
- Type: 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 operation.
Result Syntax
[]
Result Details
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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:
$result = $client->addClientIDToOpenIDConnectProvider([ 'ClientID' => 'my-application-ID', 'OpenIDConnectProviderArn' => 'arn:aws:iam::123456789012:oidc-provider/server.example.com', ]);
AddRoleToInstanceProfile
$result = $client->addRoleToInstanceProfile
([/* ... */]); $promise = $client->addRoleToInstanceProfileAsync
([/* ... */]);
Adds the specified IAM role to the specified instance profile. An instance profile can contain only one role, and this quota cannot be increased. You can remove the existing role and then add a different role to an instance profile. You must then wait for the change to appear across all of Amazon Web Services because of eventual consistency. To force the change, you must disassociate the instance profile and then associate the instance profile, or you can stop your instance and then restart it.
The caller of this operation must be granted the PassRole
permission on the IAM role by a permissions policy.
For more information about roles, see IAM roles in the IAM User Guide. For more information about instance profiles, see Using instance profiles in the IAM User Guide.
Parameter Syntax
$result = $client->addRoleToInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the instance profile to update.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- RoleName
-
- Required: Yes
- Type: string
The name of the role to add.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To add a role to an instance profile
The following command adds the role named S3Access to the instance profile named Webserver:
$result = $client->addRoleToInstanceProfile([ 'InstanceProfileName' => 'Webserver', 'RoleName' => 'S3Access', ]);
AddUserToGroup
$result = $client->addUserToGroup
([/* ... */]); $promise = $client->addUserToGroupAsync
([/* ... */]);
Adds the specified user to the specified group.
Parameter Syntax
$result = $client->addUserToGroup([ 'GroupName' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group to update.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- UserName
-
- Required: Yes
- Type: string
The name of the user to add.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To add a user to an IAM group
The following command adds an IAM user named Bob to the IAM group named Admins:
$result = $client->addUserToGroup([ 'GroupName' => 'Admins', 'UserName' => 'Bob', ]);
AttachGroupPolicy
$result = $client->attachGroupPolicy
([/* ... */]); $promise = $client->attachGroupPolicyAsync
([/* ... */]);
Attaches the specified managed policy to the specified IAM group.
You use this operation to attach a managed policy to a group. To embed an inline policy in a group, use PutGroupPolicy
.
As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.
For more information about policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->attachGroupPolicy([ 'GroupName' => '<string>', // REQUIRED 'PolicyArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the group to attach the policy to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to attach.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- PolicyNotAttachableException:
The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->attachGroupPolicy([ 'GroupName' => 'Finance', 'PolicyArn' => 'arn:aws:iam::aws:policy/ReadOnlyAccess', ]);
AttachRolePolicy
$result = $client->attachRolePolicy
([/* ... */]); $promise = $client->attachRolePolicyAsync
([/* ... */]);
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 operation 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.
As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.
Parameter Syntax
$result = $client->attachRolePolicy([ 'PolicyArn' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to attach.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
- RoleName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the role to attach the policy to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- PolicyNotAttachableException:
The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->attachRolePolicy([ 'PolicyArn' => 'arn:aws:iam::aws:policy/ReadOnlyAccess', 'RoleName' => 'ReadOnlyRole', ]);
AttachUserPolicy
$result = $client->attachUserPolicy
([/* ... */]); $promise = $client->attachUserPolicyAsync
([/* ... */]);
Attaches the specified managed policy to the specified user.
You use this operation to attach a managed policy to a user. To embed an inline policy in a user, use PutUserPolicy
.
As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.
For more information about policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->attachUserPolicy([ 'PolicyArn' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to attach.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
- UserName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM user to attach the policy to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- PolicyNotAttachableException:
The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->attachUserPolicy([ 'PolicyArn' => 'arn:aws:iam::aws:policy/AdministratorAccess', 'UserName' => 'Alice', ]);
ChangePassword
$result = $client->changePassword
([/* ... */]); $promise = $client->changePasswordAsync
([/* ... */]);
Changes the password of the IAM user who is calling this operation. This operation can be performed using the CLI, the Amazon Web Services API, or the My Security Credentials page in the Amazon Web Services Management Console. The Amazon Web Services account root user password is not affected by this operation.
Use UpdateLoginProfile to use the CLI, the Amazon Web Services API, or the Users page in the IAM console to change the password for any IAM user. For more information about modifying passwords, see Managing passwords in the IAM User Guide.
Parameter Syntax
$result = $client->changePassword([ 'NewPassword' => '<string>', // REQUIRED 'OldPassword' => '<string>', // REQUIRED ]);
Parameter Details
Members
- NewPassword
-
- Required: Yes
- Type: string
The new password. The new password must conform to the Amazon Web Services account's password policy, if one exists.
The regex pattern that is used to validate this parameter is a string of characters. That string can include 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. Any of these characters are valid in a password. However, many tools, such as the Amazon Web Services Management Console, might restrict the ability to type certain characters because they have special meaning within that tool. - OldPassword
-
- Required: Yes
- Type: string
The IAM user's current password.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidUserTypeException:
The request was rejected because the type of user for the transaction was incorrect.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- EntityTemporarilyUnmodifiableException:
The request was rejected because it referenced an entity that is temporarily unmodifiable, such as a user name that was deleted and then recreated. The error indicates that the request is likely to succeed if you try again after waiting several minutes. The error message describes the entity.
- PasswordPolicyViolationException:
The request was rejected because the provided password did not meet the requirements imposed by the account password policy.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To change the password for your IAM user
The following command changes the password for the current IAM user.
$result = $client->changePassword([ 'NewPassword' => ']35d/{pB9Fo9wJ', 'OldPassword' => '3s0K_;xh4~8XXI', ]);
CreateAccessKey
$result = $client->createAccessKey
([/* ... */]); $promise = $client->createAccessKeyAsync
([/* ... */]);
Creates a new Amazon Web Services secret access key and corresponding Amazon Web Services 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 Amazon Web Services access key ID signing the request. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials. This is true even if the Amazon Web Services account has no associated users.
For information about quotas on the number of keys you can create, see IAM and STS quotas in the IAM User Guide.
To ensure the security of your Amazon Web Services 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.
Parameter Syntax
$result = $client->createAccessKey([ 'UserName' => '<string>', ]);
Parameter Details
Members
- UserName
-
- Type: string
The name of the IAM user that the new key will belong to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'AccessKey' => [ 'AccessKeyId' => '<string>', 'CreateDate' => <DateTime>, 'SecretAccessKey' => '<string>', 'Status' => 'Active|Inactive', 'UserName' => '<string>', ], ]
Result Details
Members
- AccessKey
-
- Required: Yes
- Type: AccessKey structure
A structure with details about the access key.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->createAccessKey([ 'UserName' => 'Bob', ]);
Result syntax:
[ 'AccessKey' => [ 'AccessKeyId' => 'AKIAIOSFODNN7EXAMPLE', 'CreateDate' =>, 'SecretAccessKey' => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY', 'Status' => 'Active', 'UserName' => 'Bob', ], ]
CreateAccountAlias
$result = $client->createAccountAlias
([/* ... */]); $promise = $client->createAccountAliasAsync
([/* ... */]);
Creates an alias for your Amazon Web Services account. For information about using an Amazon Web Services account alias, see Creating, deleting, and listing an Amazon Web Services account alias in the Amazon Web Services Sign-In User Guide.
Parameter Syntax
$result = $client->createAccountAlias([ 'AccountAlias' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AccountAlias
-
- Required: Yes
- Type: string
The account alias to create.
This parameter allows (through 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.
Result Syntax
[]
Result Details
Errors
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To create an account alias
The following command associates the alias examplecorp to your AWS account.
$result = $client->createAccountAlias([ 'AccountAlias' => 'examplecorp', ]);
CreateGroup
$result = $client->createGroup
([/* ... */]); $promise = $client->createGroupAsync
([/* ... */]);
Creates a new group.
For information about the number of groups you can create, see IAM and STS quotas in the IAM User Guide.
Parameter Syntax
$result = $client->createGroup([ 'GroupName' => '<string>', // REQUIRED 'Path' => '<string>', ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group to create. Do not include the path in this value.
IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".
- Path
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'Group' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'GroupId' => '<string>', 'GroupName' => '<string>', 'Path' => '<string>', ], ]
Result Details
Members
- Group
-
- Required: Yes
- Type: Group structure
A structure containing details about the new group.
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To create an IAM group
The following command creates an IAM group named Admins.
$result = $client->createGroup([ 'GroupName' => 'Admins', ]);
Result syntax:
[ 'Group' => [ 'Arn' => 'arn:aws:iam::123456789012:group/Admins', 'CreateDate' =>, 'GroupId' => 'AIDGPMS9RO4H3FEXAMPLE', 'GroupName' => 'Admins', 'Path' => '/', ], ]
CreateInstanceProfile
$result = $client->createInstanceProfile
([/* ... */]); $promise = $client->createInstanceProfileAsync
([/* ... */]);
Creates a new instance profile. For information about instance profiles, see Using roles for applications on Amazon EC2 in the IAM User Guide, and Instance profiles in the Amazon EC2 User Guide.
For information about the number of instance profiles you can create, see IAM object quotas in the IAM User Guide.
Parameter Syntax
$result = $client->createInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED 'Path' => '<string>', 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the instance profile to create.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Path
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the newly created IAM instance profile. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
Result Syntax
[ 'InstanceProfile' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'InstanceProfileId' => '<string>', 'InstanceProfileName' => '<string>', 'Path' => '<string>', 'Roles' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], ]
Result Details
Members
- InstanceProfile
-
- Required: Yes
- Type: InstanceProfile structure
A structure containing details about the new instance profile.
Errors
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->createInstanceProfile([ 'InstanceProfileName' => 'Webserver', ]);
Result syntax:
[ 'InstanceProfile' => [ 'Arn' => 'arn:aws:iam::123456789012:instance-profile/Webserver', 'CreateDate' =>, 'InstanceProfileId' => 'AIPAJMBYC7DLSPEXAMPLE', 'InstanceProfileName' => 'Webserver', 'Path' => '/', 'Roles' => [ ], ], ]
CreateLoginProfile
$result = $client->createLoginProfile
([/* ... */]); $promise = $client->createLoginProfileAsync
([/* ... */]);
Creates a password for the specified IAM user. A password allows an IAM user to access Amazon Web Services services through the Amazon Web Services Management Console.
You can use the CLI, the Amazon Web Services API, or the Users page in the IAM console to create a password for any IAM user. Use ChangePassword to update your own existing password in the My Security Credentials page in the Amazon Web Services Management Console.
For more information about managing passwords, see Managing passwords in the IAM User Guide.
Parameter Syntax
$result = $client->createLoginProfile([ 'Password' => '<string>', // REQUIRED 'PasswordResetRequired' => true || false, 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Password
-
- Required: Yes
- Type: string
The new password for the user.
The regex pattern that is used to validate this parameter is a string of characters. That string can include 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. Any of these characters are valid in a password. However, many tools, such as the Amazon Web Services Management Console, might restrict the ability to type certain characters because they have special meaning within that tool. - PasswordResetRequired
-
- Type: boolean
Specifies whether the user is required to set a new password on next sign-in.
- UserName
-
- Required: Yes
- Type: string
The name of the IAM user to create a password for. The user must already exist.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'LoginProfile' => [ 'CreateDate' => <DateTime>, 'PasswordResetRequired' => true || false, 'UserName' => '<string>', ], ]
Result Details
Members
- LoginProfile
-
- Required: Yes
- Type: LoginProfile structure
A structure containing the user name and password create date.
Errors
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- PasswordPolicyViolationException:
The request was rejected because the provided password did not meet the requirements imposed by the account password policy.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->createLoginProfile([ 'Password' => 'h]6EszR}vJ*m', 'PasswordResetRequired' => 1, 'UserName' => 'Bob', ]);
Result syntax:
[ 'LoginProfile' => [ 'CreateDate' =>, 'PasswordResetRequired' => 1, 'UserName' => 'Bob', ], ]
CreateOpenIDConnectProvider
$result = $client->createOpenIDConnectProvider
([/* ... */]); $promise = $client->createOpenIDConnectProviderAsync
([/* ... */]);
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. Such a policy establishes a trust relationship between Amazon Web Services and the OIDC provider.
If you are using an OIDC identity provider from Google, Facebook, or Amazon Cognito, you don't need to create a separate IAM identity provider. These OIDC identity providers are already built-in to Amazon Web Services and are available for your use. Instead, you can move directly to creating new roles using your identity provider. To learn more, see Creating a role for web identity or OpenID connect federation in the IAM User Guide.
When you create the IAM OIDC provider, you specify the following:
-
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 allowed to authenticate using the OIDC provider
-
A list of tags that are attached to the specified IAM OIDC provider
-
A list of thumbprints of one or more server certificates that the IdP uses
You get all of this information from the OIDC IdP you want to use to access Amazon Web Services.
Amazon Web Services secures communication with OIDC identity providers (IdPs) using our library of trusted root certificate authorities (CAs) to verify the JSON Web Key Set (JWKS) endpoint's TLS certificate. If your OIDC IdP relies on a certificate that is not signed by one of these trusted CAs, only then we secure communication using the thumbprints set in the IdP's configuration.
The trust for the OIDC provider is derived from the IAM provider that this operation creates. Therefore, it is best to limit access to the CreateOpenIDConnectProvider operation to highly privileged users.
Parameter Syntax
$result = $client->createOpenIDConnectProvider([ 'ClientIDList' => ['<string>', ...], 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], 'ThumbprintList' => ['<string>', ...], 'Url' => '<string>', // REQUIRED ]);
Parameter Details
Members
- ClientIDList
-
- Type: Array of strings
Provides 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
operation accepts client IDs up to 255 characters long. - Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the new IAM OpenID Connect (OIDC) provider. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
- ThumbprintList
-
- Type: Array of strings
A list of server certificate thumbprints for the OpenID Connect (OIDC) identity provider's server certificates. 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.
This parameter is optional. If it is not included, IAM will retrieve and use the top intermediate certificate authority (CA) thumbprint of the OpenID Connect identity provider server certificate.
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.
For example, assume that the OIDC provider is
server.example.com
and the provider stores its keys at https://keys.server.example.com/openid-connect. In that case, the thumbprint string would be the hex-encoded SHA-1 hash value of the certificate used byhttps://keys.server.example.com.
For more information about obtaining the OIDC provider thumbprint, see Obtaining the thumbprint for an OpenID Connect provider in the IAM user Guide.
- Url
-
- Required: Yes
- Type: string
The URL of the identity provider. The URL must begin with
https://
and should correspond to theiss
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 hostname, likehttps://server.example.org
orhttps://example.com
. The URL should not contain a port number.You cannot register the same provider multiple times in a single Amazon Web Services account. If you try to submit a URL that has already been used for an OpenID Connect provider in the Amazon Web Services account, you will get an error.
Result Syntax
[ 'OpenIDConnectProviderArn' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- OpenIDConnectProviderArn
-
- Type: string
The Amazon Resource Name (ARN) of the new IAM OpenID Connect provider that is created. For more information, see OpenIDConnectProviderListEntry.
- Tags
-
- Type: Array of Tag structures
A list of tags that are attached to the new IAM OIDC provider. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- OpenIdIdpCommunicationErrorException:
The request failed because IAM cannot connect to the OpenID Connect identity provider URL.
Examples
Example 1: 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.
$result = $client->createOpenIDConnectProvider([ 'ClientIDList' => [ 'my-application-id', ], 'ThumbprintList' => [ '3768084dfb3d2b68b7897bf5f565da8efEXAMPLE', ], 'Url' => 'https://server.example.com', ]);
Result syntax:
[ 'OpenIDConnectProviderArn' => 'arn:aws:iam::123456789012:oidc-provider/server.example.com', ]
CreatePolicy
$result = $client->createPolicy
([/* ... */]); $promise = $client->createPolicyAsync
([/* ... */]);
Creates a new managed policy for your Amazon Web Services 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.
As a best practice, you can validate your IAM policies. To learn more, see Validating IAM 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.
Parameter Syntax
$result = $client->createPolicy([ 'Description' => '<string>', 'Path' => '<string>', 'PolicyDocument' => '<string>', // REQUIRED 'PolicyName' => '<string>', // REQUIRED 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- Description
-
- Type: 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.
- Path
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.You cannot use an asterisk (*) in the path name.
- PolicyDocument
-
- Required: Yes
- Type: string
The JSON policy document that you want to use as the content for the new policy.
You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
The maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
To learn more about JSON policy grammar, see Grammar of the IAM JSON policy language in the IAM User Guide.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicyName
-
- Required: Yes
- Type: string
The friendly name of the policy.
IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".
- Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the new IAM customer managed policy. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
Result Syntax
[ 'Policy' => [ 'Arn' => '<string>', 'AttachmentCount' => <integer>, 'CreateDate' => <DateTime>, 'DefaultVersionId' => '<string>', 'Description' => '<string>', 'IsAttachable' => true || false, 'Path' => '<string>', 'PermissionsBoundaryUsageCount' => <integer>, 'PolicyId' => '<string>', 'PolicyName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UpdateDate' => <DateTime>, ], ]
Result Details
Members
- Policy
-
- Type: Policy structure
A structure containing details about the new policy.
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
CreatePolicyVersion
$result = $client->createPolicyVersion
([/* ... */]); $promise = $client->createPolicyVersionAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->createPolicyVersion([ 'PolicyArn' => '<string>', // REQUIRED 'PolicyDocument' => '<string>', // REQUIRED 'SetAsDefault' => true || false, ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
- PolicyDocument
-
- Required: Yes
- Type: string
The JSON policy document that you want to use as the content for this new version of the policy.
You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
The maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- SetAsDefault
-
- Type: 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, it becomes 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.
Result Syntax
[ 'PolicyVersion' => [ 'CreateDate' => <DateTime>, 'Document' => '<string>', 'IsDefaultVersion' => true || false, 'VersionId' => '<string>', ], ]
Result Details
Members
- PolicyVersion
-
- Type: PolicyVersion structure
A structure containing details about the new policy version.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
CreateRole
$result = $client->createRole
([/* ... */]); $promise = $client->createRoleAsync
([/* ... */]);
Creates a new role for your Amazon Web Services account.
For more information about roles, see IAM roles in the IAM User Guide. For information about quotas for role names and the number of roles you can create, see IAM and STS quotas in the IAM User Guide.
Parameter Syntax
$result = $client->createRole([ 'AssumeRolePolicyDocument' => '<string>', // REQUIRED 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => '<string>', 'RoleName' => '<string>', // REQUIRED 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- AssumeRolePolicyDocument
-
- Required: Yes
- Type: string
The trust relationship policy document that grants an entity permission to assume the role.
In IAM, you must provide a JSON policy that has been converted to a string. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
Upon success, the response includes the same trust policy in JSON format.
- Description
-
- Type: string
A description of the role.
- MaxSessionDuration
-
- Type: int
The maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default value of one hour is applied. This setting can have a value from 1 hour to 12 hours.
Anyone who assumes the role from the CLI or API can use the
DurationSeconds
API parameter or theduration-seconds
CLI parameter to request a longer session. TheMaxSessionDuration
setting determines the maximum duration that can be requested using theDurationSeconds
parameter. If users don't specify a value for theDurationSeconds
parameter, their security credentials are valid for one hour by default. This applies when you use theAssumeRole*
API operations or theassume-role*
CLI operations but does not apply when you use those operations to create a console URL. For more information, see Using IAM roles in the IAM User Guide. - Path
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - PermissionsBoundary
-
- Type: string
The ARN of the managed policy that is used to set the permissions boundary for the role.
A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see Permissions boundaries for IAM entities in the IAM User Guide.
For more information about policy types, see Policy types in the IAM User Guide.
- RoleName
-
- Required: Yes
- Type: string
The name of the role to create.
IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the new role. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
Result Syntax
[ 'Role' => [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], ]
Result Details
Members
- Role
-
- Required: Yes
- Type: Role structure
A structure containing details about the new role.
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To create an IAM role
The following command creates a role named Test-Role and attaches a trust policy that you must convert from JSON to a string. Upon success, the response includes the same policy as a URL-encoded JSON string.
$result = $client->createRole([ 'AssumeRolePolicyDocument' => '', 'Path' => '/', 'RoleName' => 'Test-Role', ]);
Result syntax:
[ 'Role' => [ 'Arn' => 'arn:aws:iam::123456789012:role/Test-Role', 'AssumeRolePolicyDocument' => '', 'CreateDate' => , 'Path' => '/', 'RoleId' => 'AKIAIOSFODNN7EXAMPLE', 'RoleName' => 'Test-Role', ], ]
CreateSAMLProvider
$result = $client->createSAMLProvider
([/* ... */]); $promise = $client->createSAMLProviderAsync
([/* ... */]);
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. Such a policy can 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 Amazon Web Services Management Console or one that supports API access to Amazon Web Services.
When you create the SAML provider resource, you upload a SAML metadata document that you get from your IdP. That document 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 Amazon Web Services Management Console and About SAML 2.0-based federation in the IAM User Guide.
Parameter Syntax
$result = $client->createSAMLProvider([ 'Name' => '<string>', // REQUIRED 'SAMLMetadataDocument' => '<string>', // REQUIRED 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- Name
-
- Required: Yes
- Type: string
The name of the provider to create.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- SAMLMetadataDocument
-
- Required: Yes
- Type: 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
- Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the new IAM SAML provider. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
Result Syntax
[ 'SAMLProviderArn' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- SAMLProviderArn
-
- Type: string
The Amazon Resource Name (ARN) of the new SAML provider resource in IAM.
- Tags
-
- Type: Array of Tag structures
A list of tags that are attached to the new IAM SAML provider. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
CreateServiceLinkedRole
$result = $client->createServiceLinkedRole
([/* ... */]); $promise = $client->createServiceLinkedRoleAsync
([/* ... */]);
Creates an IAM role that is linked to a specific Amazon Web Services 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 Amazon Web Services 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. For more information, see Using service-linked roles in the IAM User Guide.
To attach a policy to this service-linked role, you must make the request using the Amazon Web Services service that depends on this role.
Parameter Syntax
$result = $client->createServiceLinkedRole([ 'AWSServiceName' => '<string>', // REQUIRED 'CustomSuffix' => '<string>', 'Description' => '<string>', ]);
Parameter Details
Members
- AWSServiceName
-
- Required: Yes
- Type: string
The service principal for the Amazon Web Services 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
.Service principals are unique and case-sensitive. To find the exact service principal for your service-linked role, see Amazon Web Services services that work with IAM in the IAM User Guide. Look for the services that have Yes in the Service-Linked Role column. Choose the Yes link to view the service-linked role documentation for that service.
- CustomSuffix
-
- Type: string
A string that you provide, which is combined with the service-provided prefix 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.Some services do not support the
CustomSuffix
parameter. If you provide an optional suffix and the operation fails, try the operation again without the suffix. - Description
-
- Type: string
The description of the role.
Result Syntax
[ 'Role' => [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], ]
Result Details
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
CreateServiceSpecificCredential
$result = $client->createServiceSpecificCredential
([/* ... */]); $promise = $client->createServiceSpecificCredentialAsync
([/* ... */]);
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.
You can create service-specific credentials for CodeCommit and Amazon Keyspaces (for Apache Cassandra).
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 CodeCommit: Git credentials, SSH keys, and Amazon Web Services access keys in the IAM User Guide.
Parameter Syntax
$result = $client->createServiceSpecificCredential([ 'ServiceName' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- ServiceName
-
- Required: Yes
- Type: string
The name of the Amazon Web Services 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.
- UserName
-
- Required: Yes
- Type: 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 (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'ServiceSpecificCredential' => [ 'CreateDate' => <DateTime>, 'ServiceName' => '<string>', 'ServicePassword' => '<string>', 'ServiceSpecificCredentialId' => '<string>', 'ServiceUserName' => '<string>', 'Status' => 'Active|Inactive', 'UserName' => '<string>', ], ]
Result Details
Members
- ServiceSpecificCredential
-
- Type: ServiceSpecificCredential structure
A structure that contains information about the newly created service-specific credential.
This is the only time that the password for this credential set is available. It cannot be recovered later. Instead, you must reset the password with ResetServiceSpecificCredential.
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceNotSupportedException:
The specified service does not support service-specific credentials.
CreateUser
$result = $client->createUser
([/* ... */]); $promise = $client->createUserAsync
([/* ... */]);
Creates a new IAM user for your Amazon Web Services account.
For information about quotas for the number of IAM users you can create, see IAM and STS quotas in the IAM User Guide.
Parameter Syntax
$result = $client->createUser([ 'Path' => '<string>', 'PermissionsBoundary' => '<string>', 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Path
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - PermissionsBoundary
-
- Type: string
The ARN of the managed policy that is used to set the permissions boundary for the user.
A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see Permissions boundaries for IAM entities in the IAM User Guide.
For more information about policy types, see Policy types in the IAM User Guide.
- Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the new user. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
- UserName
-
- Required: Yes
- Type: string
The name of the user to create.
IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".
Result Syntax
[ 'User' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'PasswordLastUsed' => <DateTime>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', ], ]
Result Details
Members
- User
-
- Type: User structure
A structure with details about the new IAM user.
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To create an IAM user
The following create-user command creates an IAM user named Bob in the current account.
$result = $client->createUser([ 'UserName' => 'Bob', ]);
Result syntax:
[ 'User' => [ 'Arn' => 'arn:aws:iam::123456789012:user/Bob', 'CreateDate' =>, 'Path' => '/', 'UserId' => 'AKIAIOSFODNN7EXAMPLE', 'UserName' => 'Bob', ], ]
CreateVirtualMFADevice
$result = $client->createVirtualMFADevice
([/* ... */]); $promise = $client->createVirtualMFADeviceAsync
([/* ... */]);
Creates a new virtual MFA device for the Amazon Web Services 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, see Using a virtual MFA device in the IAM User Guide.
For information about the maximum number of MFA devices you can create, see IAM and STS quotas 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. In other words, protect the seed information as you would your Amazon Web Services access keys or your passwords. After you provision your virtual device, you should ensure that the information is destroyed following secure procedures.
Parameter Syntax
$result = $client->createVirtualMFADevice([ 'Path' => '<string>', 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], 'VirtualMFADeviceName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Path
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - Tags
-
- Type: Array of Tag structures
A list of tags that you want to attach to the new IAM virtual MFA device. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
- VirtualMFADeviceName
-
- Required: Yes
- Type: string
The name of the virtual MFA device, which must be unique. Use with path to uniquely identify a virtual MFA device.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'VirtualMFADevice' => [ 'Base32StringSeed' => <string || resource || Psr\Http\Message\StreamInterface>, 'EnableDate' => <DateTime>, 'QRCodePNG' => <string || resource || Psr\Http\Message\StreamInterface>, 'SerialNumber' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'User' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'PasswordLastUsed' => <DateTime>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', ], ], ]
Result Details
Members
- VirtualMFADevice
-
- Required: Yes
- Type: VirtualMFADevice structure
A structure containing details about the new virtual MFA device.
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeactivateMFADevice
$result = $client->deactivateMFADevice
([/* ... */]); $promise = $client->deactivateMFADeviceAsync
([/* ... */]);
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, see Enabling a virtual multi-factor authentication (MFA) device in the IAM User Guide.
Parameter Syntax
$result = $client->deactivateMFADevice([ 'SerialNumber' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- SerialNumber
-
- Required: Yes
- Type: string
The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@:/-
- UserName
-
- Required: Yes
- Type: string
The name of the user whose MFA device you want to deactivate.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- EntityTemporarilyUnmodifiableException:
The request was rejected because it referenced an entity that is temporarily unmodifiable, such as a user name that was deleted and then recreated. The error indicates that the request is likely to succeed if you try again after waiting several minutes. The error message describes the entity.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
DeleteAccessKey
$result = $client->deleteAccessKey
([/* ... */]); $promise = $client->deleteAccessKeyAsync
([/* ... */]);
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 Amazon Web Services access key ID signing the request. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials even if the Amazon Web Services account has no associated users.
Parameter Syntax
$result = $client->deleteAccessKey([ 'AccessKeyId' => '<string>', // REQUIRED 'UserName' => '<string>', ]);
Parameter Details
Members
- AccessKeyId
-
- Required: Yes
- Type: string
The access key ID for the access key ID and secret access key you want to delete.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
- UserName
-
- Type: string
The name of the user whose access key pair you want to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->deleteAccessKey([ 'AccessKeyId' => 'AKIDPMS9RO4H3FEXAMPLE', 'UserName' => 'Bob', ]);
DeleteAccountAlias
$result = $client->deleteAccountAlias
([/* ... */]); $promise = $client->deleteAccountAliasAsync
([/* ... */]);
Deletes the specified Amazon Web Services account alias. For information about using an Amazon Web Services account alias, see Creating, deleting, and listing an Amazon Web Services account alias in the Amazon Web Services Sign-In User Guide.
Parameter Syntax
$result = $client->deleteAccountAlias([ 'AccountAlias' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AccountAlias
-
- Required: Yes
- Type: string
The name of the account alias to delete.
This parameter allows (through 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.
Result Syntax
[]
Result Details
Errors
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete an account alias
The following command removes the alias mycompany from the current AWS account:
$result = $client->deleteAccountAlias([ 'AccountAlias' => 'mycompany', ]);
DeleteAccountPasswordPolicy
$result = $client->deleteAccountPasswordPolicy
([/* ... */]); $promise = $client->deleteAccountPasswordPolicyAsync
([/* ... */]);
Deletes the password policy for the Amazon Web Services account. There are no parameters.
Parameter Syntax
$result = $client->deleteAccountPasswordPolicy([ ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete the current account password policy
The following command removes the password policy from the current AWS account:
$result = $client->deleteAccountPasswordPolicy([ ]);
DeleteGroup
$result = $client->deleteGroup
([/* ... */]); $promise = $client->deleteGroupAsync
([/* ... */]);
Deletes the specified IAM group. The group must not contain any users or have any attached policies.
Parameter Syntax
$result = $client->deleteGroup([ 'GroupName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the IAM group to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteGroupPolicy
$result = $client->deleteGroupPolicy
([/* ... */]); $promise = $client->deleteGroupPolicyAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->deleteGroupPolicy([ 'GroupName' => '<string>', // REQUIRED 'PolicyName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) identifying the group that the policy is embedded in.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- PolicyName
-
- Required: Yes
- Type: string
The name identifying the policy document to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete a policy from an IAM group
The following command deletes the policy named ExamplePolicy from the group named Admins:
$result = $client->deleteGroupPolicy([ 'GroupName' => 'Admins', 'PolicyName' => 'ExamplePolicy', ]);
DeleteInstanceProfile
$result = $client->deleteInstanceProfile
([/* ... */]); $promise = $client->deleteInstanceProfileAsync
([/* ... */]);
Deletes the specified instance profile. The instance profile must not have an associated role.
Make sure that you do not have any Amazon EC2 instances running with the instance profile you are about to delete. Deleting a role or instance profile that is associated with a running instance will break any applications running on the instance.
For more information about instance profiles, see Using instance profiles in the IAM User Guide.
Parameter Syntax
$result = $client->deleteInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the instance profile to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete an instance profile
The following command deletes the instance profile named ExampleInstanceProfile
$result = $client->deleteInstanceProfile([ 'InstanceProfileName' => 'ExampleInstanceProfile', ]);
DeleteLoginProfile
$result = $client->deleteLoginProfile
([/* ... */]); $promise = $client->deleteLoginProfileAsync
([/* ... */]);
Deletes the password for the specified IAM user, For more information, see Managing passwords for IAM users.
You can use the CLI, the Amazon Web Services API, or the Users page in the IAM console to delete a password for any IAM user. You can use ChangePassword to update, but not delete, your own password in the My Security Credentials page in the Amazon Web Services Management Console.
Deleting a user's password does not prevent a user from accessing Amazon Web Services 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.
Parameter Syntax
$result = $client->deleteLoginProfile([ 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- UserName
-
- Required: Yes
- Type: string
The name of the user whose password you want to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- EntityTemporarilyUnmodifiableException:
The request was rejected because it referenced an entity that is temporarily unmodifiable, such as a user name that was deleted and then recreated. The error indicates that the request is likely to succeed if you try again after waiting several minutes. The error message describes the entity.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete a password for an IAM user
The following command deletes the password for the IAM user named Bob.
$result = $client->deleteLoginProfile([ 'UserName' => 'Bob', ]);
DeleteOpenIDConnectProvider
$result = $client->deleteOpenIDConnectProvider
([/* ... */]); $promise = $client->deleteOpenIDConnectProviderAsync
([/* ... */]);
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 operation is idempotent; it does not fail or return an error if you call the operation for a provider that does not exist.
Parameter Syntax
$result = $client->deleteOpenIDConnectProvider([ 'OpenIDConnectProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- OpenIDConnectProviderArn
-
- Required: Yes
- Type: 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 operation.
Result Syntax
[]
Result Details
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeletePolicy
$result = $client->deletePolicy
([/* ... */]); $promise = $client->deletePolicyAsync
([/* ... */]);
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. In addition, you must delete all 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 DetachUserPolicy, DetachGroupPolicy, or DetachRolePolicy. 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 operation.
For information about managed policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->deletePolicy([ 'PolicyArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to delete.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeletePolicyVersion
$result = $client->deletePolicyVersion
([/* ... */]); $promise = $client->deletePolicyVersionAsync
([/* ... */]);
Deletes the specified version from the specified managed policy.
You cannot delete the default version from a policy using this operation. 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.
Parameter Syntax
$result = $client->deletePolicyVersion([ 'PolicyArn' => '<string>', // REQUIRED 'VersionId' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
- VersionId
-
- Required: Yes
- Type: string
The policy version to delete.
This parameter allows (through 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.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteRole
$result = $client->deleteRole
([/* ... */]); $promise = $client->deleteRoleAsync
([/* ... */]);
Deletes the specified role. Unlike the Amazon Web Services Management Console, when you delete a role programmatically, you must delete the items attached to the role manually, or the deletion fails. For more information, see Deleting an IAM role. Before attempting to delete a role, remove the following attached items:
-
Inline policies (DeleteRolePolicy)
-
Attached managed policies (DetachRolePolicy)
-
Instance profile (RemoveRoleFromInstanceProfile)
-
Optional – Delete instance profile after detaching from role for resource clean up (DeleteInstanceProfile)
Make sure that 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.
Parameter Syntax
$result = $client->deleteRole([ 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- RoleName
-
- Required: Yes
- Type: string
The name of the role to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete an IAM role
The following command removes the role named Test-Role.
$result = $client->deleteRole([ 'RoleName' => 'Test-Role', ]);
DeleteRolePermissionsBoundary
$result = $client->deleteRolePermissionsBoundary
([/* ... */]); $promise = $client->deleteRolePermissionsBoundaryAsync
([/* ... */]);
Deletes the permissions boundary for the specified IAM role.
You cannot set the boundary for a service-linked role.
Deleting the permissions boundary for a role might increase its permissions. For example, it might allow anyone who assumes the role to perform all the actions granted in its permissions policies.
Parameter Syntax
$result = $client->deleteRolePermissionsBoundary([ 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- RoleName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM role from which you want to remove the permissions boundary.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteRolePolicy
$result = $client->deleteRolePolicy
([/* ... */]); $promise = $client->deleteRolePolicyAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->deleteRolePolicy([ 'PolicyName' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyName
-
- Required: Yes
- Type: string
The name of the inline policy to delete from the specified IAM role.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- RoleName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) identifying the role that the policy is embedded in.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To remove a policy from an IAM role
The following command removes the policy named ExamplePolicy from the role named Test-Role.
$result = $client->deleteRolePolicy([ 'PolicyName' => 'ExamplePolicy', 'RoleName' => 'Test-Role', ]);
DeleteSAMLProvider
$result = $client->deleteSAMLProvider
([/* ... */]); $promise = $client->deleteSAMLProviderAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->deleteSAMLProvider([ 'SAMLProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- SAMLProviderArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the SAML provider to delete.
Result Syntax
[]
Result Details
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteSSHPublicKey
$result = $client->deleteSSHPublicKey
([/* ... */]); $promise = $client->deleteSSHPublicKeyAsync
([/* ... */]);
Deletes the specified SSH public key.
The SSH public key deleted by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.
Parameter Syntax
$result = $client->deleteSSHPublicKey([ 'SSHPublicKeyId' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- SSHPublicKeyId
-
- Required: Yes
- Type: string
The unique identifier for the SSH public key.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
- UserName
-
- Required: Yes
- Type: string
The name of the IAM user associated with the SSH public key.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
DeleteServerCertificate
$result = $client->deleteServerCertificate
([/* ... */]); $promise = $client->deleteServerCertificateAsync
([/* ... */]);
Deletes the specified server certificate.
For more information about working with server certificates, see Working with server certificates in the IAM User Guide. This topic also includes a list of Amazon Web Services services that can use the server certificates that you manage with IAM.
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, see DeleteLoadBalancerListeners in the Elastic Load Balancing API Reference.
Parameter Syntax
$result = $client->deleteServerCertificate([ 'ServerCertificateName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- ServerCertificateName
-
- Required: Yes
- Type: string
The name of the server certificate you want to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteServiceLinkedRole
$result = $client->deleteServiceLinkedRole
([/* ... */]); $promise = $client->deleteServiceLinkedRoleAsync
([/* ... */]);
Submits a service-linked role deletion request and returns a DeletionTaskId
, which you can use to check the status of the deletion. Before you call this operation, confirm that the role has no active sessions and that any resources used by the role in the linked service are deleted. If you call this operation more than once for the same service-linked role and an earlier deletion task is not complete, then the DeletionTaskId
of the earlier request is returned.
If you submit a deletion request for a service-linked role whose linked service is still accessing a resource, then the deletion task fails. If it fails, the GetServiceLinkedRoleDeletionStatus operation returns the reason for the failure, usually including the resources that must be deleted. To delete the service-linked role, you must first remove those resources from the linked service and then submit the deletion request again. Resources are specific to the service that is linked to the role. For more information about removing resources from a service, see the Amazon Web Services documentation for your service.
For more information about service-linked roles, see Roles terms and concepts: Amazon Web Services service-linked role in the IAM User Guide.
Parameter Syntax
$result = $client->deleteServiceLinkedRole([ 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- RoleName
-
- Required: Yes
- Type: string
The name of the service-linked role to be deleted.
Result Syntax
[ 'DeletionTaskId' => '<string>', ]
Result Details
Members
- DeletionTaskId
-
- Required: Yes
- Type: string
The deletion task identifier that you can use to check the status of the deletion. This identifier is returned in the format
task/aws-service-role/<service-principal-name>/<role-name>/<task-uuid>
.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteServiceSpecificCredential
$result = $client->deleteServiceSpecificCredential
([/* ... */]); $promise = $client->deleteServiceSpecificCredentialAsync
([/* ... */]);
Deletes the specified service-specific credential.
Parameter Syntax
$result = $client->deleteServiceSpecificCredential([ 'ServiceSpecificCredentialId' => '<string>', // REQUIRED 'UserName' => '<string>', ]);
Parameter Details
Members
- ServiceSpecificCredentialId
-
- Required: Yes
- Type: string
The unique identifier of the service-specific credential. You can get this value by calling ListServiceSpecificCredentials.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
- UserName
-
- Type: 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 (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
DeleteSigningCertificate
$result = $client->deleteSigningCertificate
([/* ... */]); $promise = $client->deleteSigningCertificateAsync
([/* ... */]);
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 Amazon Web Services access key ID signing the request. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials even if the Amazon Web Services account has no associated IAM users.
Parameter Syntax
$result = $client->deleteSigningCertificate([ 'CertificateId' => '<string>', // REQUIRED 'UserName' => '<string>', ]);
Parameter Details
Members
- CertificateId
-
- Required: Yes
- Type: 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.
- UserName
-
- Type: string
The name of the user the signing certificate belongs to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete a signing certificate for an IAM user
The following command deletes the specified signing certificate for the IAM user named Anika.
$result = $client->deleteSigningCertificate([ 'CertificateId' => 'TA7SMP42TDN5Z26OBPJE7EXAMPLE', 'UserName' => 'Anika', ]);
DeleteUser
$result = $client->deleteUser
([/* ... */]); $promise = $client->deleteUserAsync
([/* ... */]);
Deletes the specified IAM user. Unlike the Amazon Web Services Management Console, when you delete a user programmatically, you must delete the items attached to the user manually, or the deletion fails. For more information, see Deleting an IAM user. Before attempting to delete a user, remove the following items:
-
Password (DeleteLoginProfile)
-
Access keys (DeleteAccessKey)
-
Signing certificate (DeleteSigningCertificate)
-
SSH public key (DeleteSSHPublicKey)
-
Git credentials (DeleteServiceSpecificCredential)
-
Multi-factor authentication (MFA) device (DeactivateMFADevice, DeleteVirtualMFADevice)
-
Inline policies (DeleteUserPolicy)
-
Attached managed policies (DetachUserPolicy)
-
Group memberships (RemoveUserFromGroup)
Parameter Syntax
$result = $client->deleteUser([ 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- UserName
-
- Required: Yes
- Type: string
The name of the user to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete an IAM user
The following command removes the IAM user named Bob from the current account.
$result = $client->deleteUser([ 'UserName' => 'Bob', ]);
DeleteUserPermissionsBoundary
$result = $client->deleteUserPermissionsBoundary
([/* ... */]); $promise = $client->deleteUserPermissionsBoundaryAsync
([/* ... */]);
Deletes the permissions boundary for the specified IAM user.
Deleting the permissions boundary for a user might increase its permissions by allowing the user to perform all the actions granted in its permissions policies.
Parameter Syntax
$result = $client->deleteUserPermissionsBoundary([ 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- UserName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM user from which you want to remove the permissions boundary.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DeleteUserPolicy
$result = $client->deleteUserPolicy
([/* ... */]); $promise = $client->deleteUserPolicyAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->deleteUserPolicy([ 'PolicyName' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyName
-
- Required: Yes
- Type: string
The name identifying the policy document to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- UserName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) identifying the user that the policy is embedded in.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To remove a policy from an IAM user
The following delete-user-policy command removes the specified policy from the IAM user named Juan:
$result = $client->deleteUserPolicy([ 'PolicyName' => 'ExamplePolicy', 'UserName' => 'Juan', ]);
DeleteVirtualMFADevice
$result = $client->deleteVirtualMFADevice
([/* ... */]); $promise = $client->deleteVirtualMFADeviceAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->deleteVirtualMFADevice([ 'SerialNumber' => '<string>', // REQUIRED ]);
Parameter Details
Members
- SerialNumber
-
- Required: Yes
- Type: 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 (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@:/-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- DeleteConflictException:
The request was rejected because it attempted to delete a resource that has attached subordinate entities. The error message describes these entities.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
Examples
Example 1: To remove a virtual MFA device
The following delete-virtual-mfa-device command removes the specified MFA device from the current AWS account.
$result = $client->deleteVirtualMFADevice([ 'SerialNumber' => 'arn:aws:iam::123456789012:mfa/ExampleName', ]);
DetachGroupPolicy
$result = $client->detachGroupPolicy
([/* ... */]); $promise = $client->detachGroupPolicyAsync
([/* ... */]);
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 DeleteGroupPolicy. For information about policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->detachGroupPolicy([ 'GroupName' => '<string>', // REQUIRED 'PolicyArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM group to detach the policy from.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to detach.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DetachRolePolicy
$result = $client->detachRolePolicy
([/* ... */]); $promise = $client->detachRolePolicyAsync
([/* ... */]);
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 DeleteRolePolicy. For information about policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->detachRolePolicy([ 'PolicyArn' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to detach.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
- RoleName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM role to detach the policy from.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
DetachUserPolicy
$result = $client->detachUserPolicy
([/* ... */]); $promise = $client->detachUserPolicyAsync
([/* ... */]);
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 DeleteUserPolicy. For information about policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->detachUserPolicy([ 'PolicyArn' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the IAM policy you want to detach.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
- UserName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM user to detach the policy from.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
EnableMFADevice
$result = $client->enableMFADevice
([/* ... */]); $promise = $client->enableMFADeviceAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->enableMFADevice([ 'AuthenticationCode1' => '<string>', // REQUIRED 'AuthenticationCode2' => '<string>', // REQUIRED 'SerialNumber' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AuthenticationCode1
-
- Required: Yes
- Type: string
An authentication code emitted by the device.
The format for this parameter is a string of six 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.
- AuthenticationCode2
-
- Required: Yes
- Type: string
A subsequent authentication code emitted by the device.
The format for this parameter is a string of six 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.
- SerialNumber
-
- Required: Yes
- Type: string
The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@:/-
- UserName
-
- Required: Yes
- Type: string
The name of the IAM user for whom you want to enable the MFA device.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- EntityAlreadyExistsException:
The request was rejected because it attempted to create a resource that already exists.
- EntityTemporarilyUnmodifiableException:
The request was rejected because it referenced an entity that is temporarily unmodifiable, such as a user name that was deleted and then recreated. The error indicates that the request is likely to succeed if you try again after waiting several minutes. The error message describes the entity.
- InvalidAuthenticationCodeException:
The request was rejected because the authentication code was not recognized. The error message describes the specific error.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
GenerateCredentialReport
$result = $client->generateCredentialReport
([/* ... */]); $promise = $client->generateCredentialReportAsync
([/* ... */]);
Generates a credential report for the Amazon Web Services account. For more information about the credential report, see Getting credential reports in the IAM User Guide.
Parameter Syntax
$result = $client->generateCredentialReport([ ]);
Parameter Details
Members
Result Syntax
[ 'Description' => '<string>', 'State' => 'STARTED|INPROGRESS|COMPLETE', ]
Result Details
Members
- Description
-
- Type: string
Information about the credential report.
- State
-
- Type: string
Information about the state of the credential report.
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GenerateOrganizationsAccessReport
$result = $client->generateOrganizationsAccessReport
([/* ... */]); $promise = $client->generateOrganizationsAccessReportAsync
([/* ... */]);
Generates a report for service last accessed data for Organizations. You can generate a report for any entities (organization root, organizational unit, or account) or policies in your organization.
To call this operation, you must be signed in using your Organizations management account credentials. You can use your long-term IAM user or root user credentials, or temporary credentials from assuming an IAM role. SCPs must be enabled for your organization root. You must have the required IAM and Organizations permissions. For more information, see Refining permissions using service last accessed data in the IAM User Guide.
You can generate a service last accessed data report for entities by specifying only the entity's path. This data includes a list of services that are allowed by any service control policies (SCPs) that apply to the entity.
You can generate a service last accessed data report for a policy by specifying an entity's path and an optional Organizations policy ID. This data includes a list of services that are allowed by the specified SCP.
For each service in both report types, the data includes the most recent account activity that the policy allows to account principals in the entity or the entity's children. For important information about the data, reporting period, permissions required, troubleshooting, and supported Regions see Reducing permissions using service last accessed data in the IAM User Guide.
The data includes all attempts to access Amazon Web Services, not just the successful ones. This includes all attempts that were made using the Amazon Web Services Management Console, the Amazon Web Services API through any of the SDKs, or any of the command line tools. An unexpected entry in the service last accessed data does not mean that an account has been compromised, because the request might have been denied. Refer to your CloudTrail logs as the authoritative source for information about all API calls and whether they were successful or denied access. For more information, see Logging IAM events with CloudTrail in the IAM User Guide.
This operation returns a JobId
. Use this parameter in the GetOrganizationsAccessReport
operation to check the status of the report generation. To check the status of this request, use the JobId
parameter in the GetOrganizationsAccessReport
operation and test the JobStatus
response parameter. When the job is complete, you can retrieve the report.
To generate a service last accessed data report for entities, specify an entity path without specifying the optional Organizations policy ID. The type of entity that you specify determines the data returned in the report.
-
Root – When you specify the organizations root as the entity, the resulting report lists all of the services allowed by SCPs that are attached to your root. For each service, the report includes data for all accounts in your organization except the management account, because the management account is not limited by SCPs.
-
OU – When you specify an organizational unit (OU) as the entity, the resulting report lists all of the services allowed by SCPs that are attached to the OU and its parents. For each service, the report includes data for all accounts in the OU or its children. This data excludes the management account, because the management account is not limited by SCPs.
-
management account – When you specify the management account, the resulting report lists all Amazon Web Services services, because the management account is not limited by SCPs. For each service, the report includes data for only the management account.
-
Account – When you specify another account as the entity, the resulting report lists all of the services allowed by SCPs that are attached to the account and its parents. For each service, the report includes data for only the specified account.
To generate a service last accessed data report for policies, specify an entity path and the optional Organizations policy ID. The type of entity that you specify determines the data returned for each service.
-
Root – When you specify the root entity and a policy ID, the resulting report lists all of the services that are allowed by the specified SCP. For each service, the report includes data for all accounts in your organization to which the SCP applies. This data excludes the management account, because the management account is not limited by SCPs. If the SCP is not attached to any entities in the organization, then the report will return a list of services with no data.
-
OU – When you specify an OU entity and a policy ID, the resulting report lists all of the services that are allowed by the specified SCP. For each service, the report includes data for all accounts in the OU or its children to which the SCP applies. This means that other accounts outside the OU that are affected by the SCP might not be included in the data. This data excludes the management account, because the management account is not limited by SCPs. If the SCP is not attached to the OU or one of its children, the report will return a list of services with no data.
-
management account – When you specify the management account, the resulting report lists all Amazon Web Services services, because the management account is not limited by SCPs. If you specify a policy ID in the CLI or API, the policy is ignored. For each service, the report includes data for only the management account.
-
Account – When you specify another account entity and a policy ID, the resulting report lists all of the services that are allowed by the specified SCP. For each service, the report includes data for only the specified account. This means that other accounts in the organization that are affected by the SCP might not be included in the data. If the SCP is not attached to the account, the report will return a list of services with no data.
Service last accessed data does not use other policy types when determining whether a principal could access a service. These other policy types include identity-based policies, resource-based policies, access control lists, IAM permissions boundaries, and STS assume role policies. It only applies SCP logic. For more about the evaluation of policy types, see Evaluating policies in the IAM User Guide.
For more information about service last accessed data, see Reducing policy scope by viewing user activity in the IAM User Guide.
Parameter Syntax
$result = $client->generateOrganizationsAccessReport([ 'EntityPath' => '<string>', // REQUIRED 'OrganizationsPolicyId' => '<string>', ]);
Parameter Details
Members
- EntityPath
-
- Required: Yes
- Type: string
The path of the Organizations entity (root, OU, or account). You can build an entity path using the known structure of your organization. For example, assume that your account ID is
123456789012
and its parent OU ID isou-rge0-awsabcde
. The organization root ID isr-f6g7h8i9j0example
and your organization ID iso-a1b2c3d4e5
. Your entity path iso-a1b2c3d4e5/r-f6g7h8i9j0example/ou-rge0-awsabcde/123456789012
. - OrganizationsPolicyId
-
- Type: string
The identifier of the Organizations service control policy (SCP). This parameter is optional.
This ID is used to generate information about when an account principal that is limited by the SCP attempted to access an Amazon Web Services service.
Result Syntax
[ 'JobId' => '<string>', ]
Result Details
Members
- JobId
-
- Type: string
The job identifier that you can use in the GetOrganizationsAccessReport operation.
Errors
- ReportGenerationLimitExceededException:
The request failed because the maximum number of concurrent requests for this account are already running.
Examples
Example 1: To generate a service last accessed data report for an organizational unit
The following operation generates a report for the organizational unit ou-rge0-awexample
$result = $client->generateOrganizationsAccessReport([ 'EntityPath' => 'o-a1b2c3d4e5/r-f6g7h8i9j0example/ou-1a2b3c-k9l8m7n6o5example', ]);
Result syntax:
[ 'JobId' => 'examplea-1234-b567-cde8-90fg123abcd4', ]
GenerateServiceLastAccessedDetails
$result = $client->generateServiceLastAccessedDetails
([/* ... */]); $promise = $client->generateServiceLastAccessedDetailsAsync
([/* ... */]);
Generates a report that includes details about when an IAM resource (user, group, role, or policy) was last used in an attempt to access Amazon Web Services services. Recent activity usually appears within four hours. IAM reports activity for at least the last 400 days, or less if your Region began supporting this feature within the last year. For more information, see Regions where data is tracked. For more information about services and actions for which action last accessed information is displayed, see IAM action last accessed information services and actions.
The service last accessed data includes all attempts to access an Amazon Web Services API, not just the successful ones. This includes all attempts that were made using the Amazon Web Services Management Console, the Amazon Web Services API through any of the SDKs, or any of the command line tools. An unexpected entry in the service last accessed data does not mean that your account has been compromised, because the request might have been denied. Refer to your CloudTrail logs as the authoritative source for information about all API calls and whether they were successful or denied access. For more information, see Logging IAM events with CloudTrail in the IAM User Guide.
The GenerateServiceLastAccessedDetails
operation returns a JobId
. Use this parameter in the following operations to retrieve the following details from your report:
-
GetServiceLastAccessedDetails – Use this operation for users, groups, roles, or policies to list every Amazon Web Services service that the resource could access using permissions policies. For each service, the response includes information about the most recent access attempt.
The
JobId
returned byGenerateServiceLastAccessedDetail
must be used by the same role within a session, or by the same user when used to callGetServiceLastAccessedDetail
. -
GetServiceLastAccessedDetailsWithEntities – Use this operation for groups and policies to list information about the associated entities (users or roles) that attempted to access a specific Amazon Web Services service.
To check the status of the GenerateServiceLastAccessedDetails
request, use the JobId
parameter in the same operations and test the JobStatus
response parameter.
For additional information about the permissions policies that allow an identity (user, group, or role) to access specific services, use the ListPoliciesGrantingServiceAccess operation.
Service last accessed data does not use other policy types when determining whether a resource could access a service. These other policy types include resource-based policies, access control lists, Organizations policies, IAM permissions boundaries, and STS assume role policies. It only applies permissions policy logic. For more about the evaluation of policy types, see Evaluating policies in the IAM User Guide.
For more information about service and action last accessed data, see Reducing permissions using service last accessed data in the IAM User Guide.
Parameter Syntax
$result = $client->generateServiceLastAccessedDetails([ 'Arn' => '<string>', // REQUIRED 'Granularity' => 'SERVICE_LEVEL|ACTION_LEVEL', ]);
Parameter Details
Members
- Arn
-
- Required: Yes
- Type: string
The ARN of the IAM resource (user, group, role, or managed policy) used to generate information about when the resource was last used in an attempt to access an Amazon Web Services service.
- Granularity
-
- Type: string
The level of detail that you want to generate. You can specify whether you want to generate information about the last attempt to access services or actions. If you specify service-level granularity, this operation generates only service data. If you specify action-level granularity, it generates service and action data. If you don't include this optional parameter, the operation generates service data.
Result Syntax
[ 'JobId' => '<string>', ]
Result Details
Members
- JobId
-
- Type: string
The
JobId
that you can use in the GetServiceLastAccessedDetails or GetServiceLastAccessedDetailsWithEntities operations. TheJobId
returned byGenerateServiceLastAccessedDetail
must be used by the same role within a session, or by the same user when used to callGetServiceLastAccessedDetail
.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
Examples
Example 1: To generate a service last accessed data report for a policy
The following operation generates a report for the policy: ExamplePolicy1
$result = $client->generateServiceLastAccessedDetails([ 'Arn' => 'arn:aws:iam::123456789012:policy/ExamplePolicy1', ]);
Result syntax:
[ 'JobId' => 'examplef-1305-c245-eba4-71fe298bcda7', ]
GetAccessKeyLastUsed
$result = $client->getAccessKeyLastUsed
([/* ... */]); $promise = $client->getAccessKeyLastUsedAsync
([/* ... */]);
Retrieves information about when the specified access key was last used. The information includes the date and time of last use, along with the Amazon Web Services service and Region that were specified in the last request made with that key.
Parameter Syntax
$result = $client->getAccessKeyLastUsed([ 'AccessKeyId' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AccessKeyId
-
- Required: Yes
- Type: string
The identifier of an access key.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
Result Syntax
[ 'AccessKeyLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', 'ServiceName' => '<string>', ], 'UserName' => '<string>', ]
Result Details
Members
- AccessKeyLastUsed
-
- Type: AccessKeyLastUsed structure
Contains information about the last time the access key was used.
- UserName
-
- Type: string
The name of the IAM user that owns this access key.
Errors
There are no errors described for this operation.
GetAccountAuthorizationDetails
$result = $client->getAccountAuthorizationDetails
([/* ... */]); $promise = $client->getAccountAuthorizationDetailsAsync
([/* ... */]);
Retrieves information about all IAM users, groups, roles, and policies in your Amazon Web Services account, including their relationships to one another. Use this operation to obtain a snapshot of the configuration of IAM permissions (users, groups, roles, and policies) in your account.
Policies returned by this operation 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.
You can optionally filter the results using the Filter
parameter. You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->getAccountAuthorizationDetails([ 'Filter' => ['<string>', ...], 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- Filter
-
- Type: Array of strings
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.
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'GroupDetailList' => [ [ 'Arn' => '<string>', 'AttachedManagedPolicies' => [ [ 'PolicyArn' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'CreateDate' => <DateTime>, 'GroupId' => '<string>', 'GroupName' => '<string>', 'GroupPolicyList' => [ [ 'PolicyDocument' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'Path' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', 'Policies' => [ [ 'Arn' => '<string>', 'AttachmentCount' => <integer>, 'CreateDate' => <DateTime>, 'DefaultVersionId' => '<string>', 'Description' => '<string>', 'IsAttachable' => true || false, 'Path' => '<string>', 'PermissionsBoundaryUsageCount' => <integer>, 'PolicyId' => '<string>', 'PolicyName' => '<string>', 'PolicyVersionList' => [ [ 'CreateDate' => <DateTime>, 'Document' => '<string>', 'IsDefaultVersion' => true || false, 'VersionId' => '<string>', ], // ... ], 'UpdateDate' => <DateTime>, ], // ... ], 'RoleDetailList' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'AttachedManagedPolicies' => [ [ 'PolicyArn' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'CreateDate' => <DateTime>, 'InstanceProfileList' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'InstanceProfileId' => '<string>', 'InstanceProfileName' => '<string>', 'Path' => '<string>', 'Roles' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'RolePolicyList' => [ [ 'PolicyDocument' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'UserDetailList' => [ [ 'Arn' => '<string>', 'AttachedManagedPolicies' => [ [ 'PolicyArn' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'CreateDate' => <DateTime>, 'GroupList' => ['<string>', ...], 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', 'UserPolicyList' => [ [ 'PolicyDocument' => '<string>', 'PolicyName' => '<string>', ], // ... ], ], // ... ], ]
Result Details
Members
- GroupDetailList
-
- Type: Array of GroupDetail structures
A list containing information about IAM groups.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Policies
-
- Type: Array of ManagedPolicyDetail structures
A list containing information about managed policies.
- RoleDetailList
-
- Type: Array of RoleDetail structures
A list containing information about IAM roles.
- UserDetailList
-
- Type: Array of UserDetail structures
A list containing information about IAM users.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetAccountPasswordPolicy
$result = $client->getAccountPasswordPolicy
([/* ... */]); $promise = $client->getAccountPasswordPolicyAsync
([/* ... */]);
Retrieves the password policy for the Amazon Web Services account. This tells you the complexity requirements and mandatory rotation periods for the IAM user passwords in your account. For more information about using a password policy, see Managing an IAM password policy.
Parameter Syntax
$result = $client->getAccountPasswordPolicy([ ]);
Parameter Details
Members
Result Syntax
[ 'PasswordPolicy' => [ 'AllowUsersToChangePassword' => true || false, 'ExpirePasswords' => true || false, 'HardExpiry' => true || false, 'MaxPasswordAge' => <integer>, 'MinimumPasswordLength' => <integer>, 'PasswordReusePrevention' => <integer>, 'RequireLowercaseCharacters' => true || false, 'RequireNumbers' => true || false, 'RequireSymbols' => true || false, 'RequireUppercaseCharacters' => true || false, ], ]
Result Details
Members
- PasswordPolicy
-
- Required: Yes
- Type: PasswordPolicy structure
A structure that contains details about the account's password policy.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To see the current account password policy
The following command displays details about the password policy for the current AWS account.
$result = $client->getAccountPasswordPolicy([ ]);
Result syntax:
[ 'PasswordPolicy' => [ 'AllowUsersToChangePassword' => , 'ExpirePasswords' => , 'HardExpiry' => , 'MaxPasswordAge' => 90, 'MinimumPasswordLength' => 8, 'PasswordReusePrevention' => 12, 'RequireLowercaseCharacters' => , 'RequireNumbers' => 1, 'RequireSymbols' => 1, 'RequireUppercaseCharacters' => , ], ]
GetAccountSummary
$result = $client->getAccountSummary
([/* ... */]); $promise = $client->getAccountSummaryAsync
([/* ... */]);
Retrieves information about IAM entity usage and IAM quotas in the Amazon Web Services account.
For information about IAM quotas, see IAM and STS quotas in the IAM User Guide.
Parameter Syntax
$result = $client->getAccountSummary([ ]);
Parameter Details
Members
Result Syntax
[ 'SummaryMap' => [<integer>, ...], ]
Result Details
Members
- SummaryMap
-
- Type: Associative array of custom strings keys (summaryKeyType) to ints
A set of key–value pairs containing information about IAM entity usage and IAM quotas.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->getAccountSummary([ ]);
Result syntax:
[ 'SummaryMap' => [ 'AccessKeysPerUserQuota' => 2, 'AccountAccessKeysPresent' => 1, 'AccountMFAEnabled' => 0, 'AccountSigningCertificatesPresent' => 0, 'AttachedPoliciesPerGroupQuota' => 10, 'AttachedPoliciesPerRoleQuota' => 10, 'AttachedPoliciesPerUserQuota' => 10, 'GlobalEndpointTokenVersion' => 2, '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, ], ]
GetContextKeysForCustomPolicy
$result = $client->getContextKeysForCustomPolicy
([/* ... */]); $promise = $client->getContextKeysForCustomPolicyAsync
([/* ... */]);
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 Amazon Web Services and its services that provide details about the context of an API query request. Context keys 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.
Parameter Syntax
$result = $client->getContextKeysForCustomPolicy([ 'PolicyInputList' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- PolicyInputList
-
- Required: Yes
- Type: Array of strings
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 the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
Result Syntax
[ 'ContextKeyNames' => ['<string>', ...], ]
Result Details
Members
- ContextKeyNames
-
- Type: Array of strings
The list of context keys that are referenced in the input policies.
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
GetContextKeysForPrincipalPolicy
$result = $client->getContextKeysForPrincipalPolicy
([/* ... */]); $promise = $client->getContextKeysForPrincipalPolicyAsync
([/* ... */]);
Gets a list of all of the context keys referenced in all the IAM policies that are 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 operation 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 Amazon Web Services and its services that provide details about the context of an API query request. Context keys 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.
Parameter Syntax
$result = $client->getContextKeysForPrincipalPolicy([ 'PolicyInputList' => ['<string>', ...], 'PolicySourceArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyInputList
-
- Type: Array of strings
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 the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicySourceArn
-
- Required: Yes
- Type: 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 that are attached to the user. The list also includes 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) in the Amazon Web Services General Reference.
Result Syntax
[ 'ContextKeyNames' => ['<string>', ...], ]
Result Details
Members
- ContextKeyNames
-
- Type: Array of strings
The list of context keys that are referenced in the input policies.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
GetCredentialReport
$result = $client->getCredentialReport
([/* ... */]); $promise = $client->getCredentialReportAsync
([/* ... */]);
Retrieves a credential report for the Amazon Web Services account. For more information about the credential report, see Getting credential reports in the IAM User Guide.
Parameter Syntax
$result = $client->getCredentialReport([ ]);
Parameter Details
Members
Result Syntax
[ 'Content' => <string || resource || Psr\Http\Message\StreamInterface>, 'GeneratedTime' => <DateTime>, 'ReportFormat' => 'text/csv', ]
Result Details
Members
- Content
-
- Type: blob (string|resource|Psr\Http\Message\StreamInterface)
Contains the credential report. The report is Base64-encoded.
- GeneratedTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time when the credential report was created, in ISO 8601 date-time format.
- ReportFormat
-
- Type: string
The format (MIME type) of the credential report.
Errors
- CredentialReportNotPresentException:
The request was rejected because the credential report does not exist. To generate a credential report, use GenerateCredentialReport.
- CredentialReportExpiredException:
The request was rejected because the most recent credential report has expired. To generate a new credential report, use GenerateCredentialReport. For more information about credential report expiration, see Getting credential reports in the IAM User Guide.
- CredentialReportNotReadyException:
The request was rejected because the credential report is still being generated.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetGroup
$result = $client->getGroup
([/* ... */]); $promise = $client->getGroupAsync
([/* ... */]);
Returns a list of IAM users that are in the specified IAM group. You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->getGroup([ 'GroupName' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'Group' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'GroupId' => '<string>', 'GroupName' => '<string>', 'Path' => '<string>', ], 'IsTruncated' => true || false, 'Marker' => '<string>', 'Users' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'PasswordLastUsed' => <DateTime>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', ], // ... ], ]
Result Details
Members
- Group
-
- Required: Yes
- Type: Group structure
A structure that contains details about the group.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Users
-
- Required: Yes
- Type: Array of User structures
A list of users in the group.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetGroupPolicy
$result = $client->getGroupPolicy
([/* ... */]); $promise = $client->getGroupPolicyAsync
([/* ... */]);
Retrieves the specified inline policy document that is embedded in the specified IAM group.
Policies returned by this operation 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.
Parameter Syntax
$result = $client->getGroupPolicy([ 'GroupName' => '<string>', // REQUIRED 'PolicyName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group the policy is associated with.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy document to get.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'GroupName' => '<string>', 'PolicyDocument' => '<string>', 'PolicyName' => '<string>', ]
Result Details
Members
- GroupName
-
- Required: Yes
- Type: string
The group the policy is associated with.
- PolicyDocument
-
- Required: Yes
- Type: string
The policy document.
IAM stores policies in JSON format. However, resources that were created using CloudFormation templates can be formatted in YAML. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetInstanceProfile
$result = $client->getInstanceProfile
([/* ... */]); $promise = $client->getInstanceProfileAsync
([/* ... */]);
Retrieves information about the specified instance profile, including the instance profile's path, GUID, ARN, and role. For more information about instance profiles, see Using instance profiles in the IAM User Guide.
Parameter Syntax
$result = $client->getInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the instance profile to get information about.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'InstanceProfile' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'InstanceProfileId' => '<string>', 'InstanceProfileName' => '<string>', 'Path' => '<string>', 'Roles' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], ]
Result Details
Members
- InstanceProfile
-
- Required: Yes
- Type: InstanceProfile structure
A structure containing details about the instance profile.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To get information about an instance profile
The following command gets information about the instance profile named ExampleInstanceProfile.
$result = $client->getInstanceProfile([ 'InstanceProfileName' => 'ExampleInstanceProfile', ]);
Result syntax:
[ 'InstanceProfile' => [ 'Arn' => 'arn:aws:iam::336924118301:instance-profile/ExampleInstanceProfile', 'CreateDate' =>, 'InstanceProfileId' => 'AID2MAB8DPLSRHEXAMPLE', 'InstanceProfileName' => 'ExampleInstanceProfile', 'Path' => '/', 'Roles' => [ [ 'Arn' => 'arn:aws:iam::336924118301:role/Test-Role', 'AssumeRolePolicyDocument' => ' ', 'CreateDate' => , 'Path' => '/', 'RoleId' => 'AIDGPMS9RO4H3FEXAMPLE', 'RoleName' => 'Test-Role', ], ], ], ]
GetLoginProfile
$result = $client->getLoginProfile
([/* ... */]); $promise = $client->getLoginProfileAsync
([/* ... */]);
Retrieves the user name for the specified IAM user. A login profile is created when you create a password for the user to access the Amazon Web Services Management Console. If the user does not exist or does not have a password, the operation returns a 404 (NoSuchEntity
) error.
If you create an IAM user with access to the console, the CreateDate
reflects the date you created the initial password for the user.
If you create an IAM user with programmatic access, and then later add a password for the user to access the Amazon Web Services Management Console, the CreateDate
reflects the initial password creation date. A user with programmatic access does not have a login profile unless you create a password for the user to access the Amazon Web Services Management Console.
Parameter Syntax
$result = $client->getLoginProfile([ 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- UserName
-
- Required: Yes
- Type: string
The name of the user whose login profile you want to retrieve.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'LoginProfile' => [ 'CreateDate' => <DateTime>, 'PasswordResetRequired' => true || false, 'UserName' => '<string>', ], ]
Result Details
Members
- LoginProfile
-
- Required: Yes
- Type: LoginProfile structure
A structure containing the user name and the profile creation date for the user.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To get password information for an IAM user
The following command gets information about the password for the IAM user named Anika.
$result = $client->getLoginProfile([ 'UserName' => 'Anika', ]);
Result syntax:
[ 'LoginProfile' => [ 'CreateDate' =>, 'UserName' => 'Anika', ], ]
GetMFADevice
$result = $client->getMFADevice
([/* ... */]); $promise = $client->getMFADeviceAsync
([/* ... */]);
Retrieves information about an MFA device for a specified user.
Parameter Syntax
$result = $client->getMFADevice([ 'SerialNumber' => '<string>', // REQUIRED 'UserName' => '<string>', ]);
Parameter Details
Members
- SerialNumber
-
- Required: Yes
- Type: string
Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key ARNs.
- UserName
-
- Type: string
The friendly name identifying the user.
Result Syntax
[ 'Certifications' => ['<string>', ...], 'EnableDate' => <DateTime>, 'SerialNumber' => '<string>', 'UserName' => '<string>', ]
Result Details
Members
- Certifications
-
- Type: Associative array of custom strings keys (CertificationKeyType) to strings
The certifications of a specified user's MFA device. We currently provide FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from FIDO Alliance Metadata Service (MDS).
- EnableDate
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date that a specified user's MFA device was first enabled.
- SerialNumber
-
- Required: Yes
- Type: string
Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key ARNs.
- UserName
-
- Type: string
The friendly name identifying the user.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetOpenIDConnectProvider
$result = $client->getOpenIDConnectProvider
([/* ... */]); $promise = $client->getOpenIDConnectProviderAsync
([/* ... */]);
Returns information about the specified OpenID Connect (OIDC) provider resource object in IAM.
Parameter Syntax
$result = $client->getOpenIDConnectProvider([ 'OpenIDConnectProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- OpenIDConnectProviderArn
-
- Required: Yes
- Type: 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 operation.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
Result Syntax
[ 'ClientIDList' => ['<string>', ...], 'CreateDate' => <DateTime>, 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'ThumbprintList' => ['<string>', ...], 'Url' => '<string>', ]
Result Details
Members
- ClientIDList
-
- Type: Array of strings
A list of client IDs (also known as audiences) that are associated with the specified IAM OIDC provider resource object. For more information, see CreateOpenIDConnectProvider.
- CreateDate
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time when the IAM OIDC provider resource object was created in the Amazon Web Services account.
- Tags
-
- Type: Array of Tag structures
A list of tags that are attached to the specified IAM OIDC provider. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
- ThumbprintList
-
- Type: Array of strings
A list of certificate thumbprints that are associated with the specified IAM OIDC provider resource object. For more information, see CreateOpenIDConnectProvider.
- Url
-
- Type: string
The URL that the IAM OIDC provider resource object is associated with. For more information, see CreateOpenIDConnectProvider.
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetOrganizationsAccessReport
$result = $client->getOrganizationsAccessReport
([/* ... */]); $promise = $client->getOrganizationsAccessReportAsync
([/* ... */]);
Retrieves the service last accessed data report for Organizations that was previously generated using the GenerateOrganizationsAccessReport
operation. This operation retrieves the status of your report job and the report contents.
Depending on the parameters that you passed when you generated the report, the data returned could include different information. For details, see GenerateOrganizationsAccessReport.
To call this operation, you must be signed in to the management account in your organization. SCPs must be enabled for your organization root. You must have permissions to perform this operation. For more information, see Refining permissions using service last accessed data in the IAM User Guide.
For each service that principals in an account (root user, IAM users, or IAM roles) could access using SCPs, the operation returns details about the most recent access attempt. If there was no attempt, the service is listed without details about the most recent attempt to access the service. If the operation fails, it returns the reason that it failed.
By default, the list is sorted by service namespace.
Parameter Syntax
$result = $client->getOrganizationsAccessReport([ 'JobId' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, 'SortKey' => 'SERVICE_NAMESPACE_ASCENDING|SERVICE_NAMESPACE_DESCENDING|LAST_AUTHENTICATED_TIME_ASCENDING|LAST_AUTHENTICATED_TIME_DESCENDING', ]);
Parameter Details
Members
- JobId
-
- Required: Yes
- Type: string
The identifier of the request generated by the GenerateOrganizationsAccessReport operation.
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - SortKey
-
- Type: string
The key that is used to sort the results. If you choose the namespace key, the results are returned in alphabetical order. If you choose the time key, the results are sorted numerically by the date and time.
Result Syntax
[ 'AccessDetails' => [ [ 'EntityPath' => '<string>', 'LastAuthenticatedTime' => <DateTime>, 'Region' => '<string>', 'ServiceName' => '<string>', 'ServiceNamespace' => '<string>', 'TotalAuthenticatedEntities' => <integer>, ], // ... ], 'ErrorDetails' => [ 'Code' => '<string>', 'Message' => '<string>', ], 'IsTruncated' => true || false, 'JobCompletionDate' => <DateTime>, 'JobCreationDate' => <DateTime>, 'JobStatus' => 'IN_PROGRESS|COMPLETED|FAILED', 'Marker' => '<string>', 'NumberOfServicesAccessible' => <integer>, 'NumberOfServicesNotAccessed' => <integer>, ]
Result Details
Members
- AccessDetails
-
- Type: Array of AccessDetail structures
An object that contains details about the most recent attempt to access the service.
- ErrorDetails
-
- Type: ErrorDetails structure
Contains information about the reason that the operation failed.
This data type is used as a response element in the GetOrganizationsAccessReport, GetServiceLastAccessedDetails, and GetServiceLastAccessedDetailsWithEntities operations.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - JobCompletionDate
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time, in ISO 8601 date-time format, when the generated report job was completed or failed.
This field is null if the job is still in progress, as indicated by a job status value of
IN_PROGRESS
. - JobCreationDate
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time, in ISO 8601 date-time format, when the report job was created.
- JobStatus
-
- Required: Yes
- Type: string
The status of the job.
- Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - NumberOfServicesAccessible
-
- Type: int
The number of services that the applicable SCPs allow account principals to access.
- NumberOfServicesNotAccessed
-
- Type: int
The number of services that account principals are allowed but did not attempt to access.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
Examples
Example 1: To get details from a previously generated organizational unit report
The following operation gets details about the report with the job ID: examplea-1234-b567-cde8-90fg123abcd4
$result = $client->getOrganizationsAccessReport([ 'JobId' => 'examplea-1234-b567-cde8-90fg123abcd4', ]);
Result syntax:
[ 'AccessDetails' => [ [ 'EntityPath' => 'o-a1b2c3d4e5/r-f6g7h8i9j0example/ou-1a2b3c-k9l8m7n6o5example/111122223333', 'LastAuthenticatedTime' =>, 'Region' => 'us-east-1', 'ServiceName' => 'Amazon DynamoDB', 'ServiceNamespace' => 'dynamodb', 'TotalAuthenticatedEntities' => 2, ], [ 'EntityPath' => 'o-a1b2c3d4e5/r-f6g7h8i9j0example/ou-1a2b3c-k9l8m7n6o5example/123456789012', 'LastAuthenticatedTime' => , 'Region' => 'us-east-1', 'ServiceName' => 'AWS Identity and Access Management', 'ServiceNamespace' => 'iam', 'TotalAuthenticatedEntities' => 4, ], [ 'ServiceName' => 'Amazon Simple Storage Service', 'ServiceNamespace' => 's3', 'TotalAuthenticatedEntities' => 0, ], ], 'IsTruncated' => , 'JobCompletionDate' => , 'JobCreationDate' => , 'JobStatus' => 'COMPLETED', 'NumberOfServicesAccessible' => 3, 'NumberOfServicesNotAccessed' => 1, ]
GetPolicy
$result = $client->getPolicy
([/* ... */]); $promise = $client->getPolicyAsync
([/* ... */]);
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 ListEntitiesForPolicy. This operation returns metadata about the policy. To retrieve the actual policy document for a specific version of the policy, use GetPolicyVersion.
This operation retrieves information about managed policies. To retrieve information about an inline policy that is embedded with an IAM user, group, or role, use GetUserPolicy, GetGroupPolicy, or GetRolePolicy.
For more information about policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->getPolicy([ 'PolicyArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
Result Syntax
[ 'Policy' => [ 'Arn' => '<string>', 'AttachmentCount' => <integer>, 'CreateDate' => <DateTime>, 'DefaultVersionId' => '<string>', 'Description' => '<string>', 'IsAttachable' => true || false, 'Path' => '<string>', 'PermissionsBoundaryUsageCount' => <integer>, 'PolicyId' => '<string>', 'PolicyName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UpdateDate' => <DateTime>, ], ]
Result Details
Members
- Policy
-
- Type: Policy structure
A structure containing details about the policy.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetPolicyVersion
$result = $client->getPolicyVersion
([/* ... */]); $promise = $client->getPolicyVersionAsync
([/* ... */]);
Retrieves information about the specified version of the specified managed policy, including the policy document.
Policies returned by this operation 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 operation retrieves information about managed policies. To retrieve information about an inline policy that is embedded in a user, group, or role, use GetUserPolicy, GetGroupPolicy, or GetRolePolicy.
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.
Parameter Syntax
$result = $client->getPolicyVersion([ 'PolicyArn' => '<string>', // REQUIRED 'VersionId' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
- VersionId
-
- Required: Yes
- Type: string
Identifies the policy version to retrieve.
This parameter allows (through 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.
Result Syntax
[ 'PolicyVersion' => [ 'CreateDate' => <DateTime>, 'Document' => '<string>', 'IsDefaultVersion' => true || false, 'VersionId' => '<string>', ], ]
Result Details
Members
- PolicyVersion
-
- Type: PolicyVersion structure
A structure containing details about the policy version.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetRole
$result = $client->getRole
([/* ... */]); $promise = $client->getRoleAsync
([/* ... */]);
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 IAM roles in the IAM User Guide.
Policies returned by this operation 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.
Parameter Syntax
$result = $client->getRole([ 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- RoleName
-
- Required: Yes
- Type: string
The name of the IAM role to get information about.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'Role' => [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], ]
Result Details
Members
- Role
-
- Required: Yes
- Type: Role structure
A structure containing details about the IAM role.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To get information about an IAM role
The following command gets information about the role named Test-Role.
$result = $client->getRole([ 'RoleName' => 'Test-Role', ]);
Result syntax:
[ 'Role' => [ 'Arn' => 'arn:aws:iam::123456789012:role/Test-Role', 'AssumeRolePolicyDocument' => '', 'CreateDate' => , 'MaxSessionDuration' => 3600, 'Path' => '/', 'RoleId' => 'AROADBQP57FF2AEXAMPLE', 'RoleLastUsed' => [ 'LastUsedDate' => , 'Region' => 'us-east-1', ], 'RoleName' => 'Test-Role', ], ]
GetRolePolicy
$result = $client->getRolePolicy
([/* ... */]); $promise = $client->getRolePolicyAsync
([/* ... */]);
Retrieves the specified inline policy document that is embedded with the specified IAM role.
Policies returned by this operation 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 IAM roles in the IAM User Guide.
Parameter Syntax
$result = $client->getRolePolicy([ 'PolicyName' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy document to get.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- RoleName
-
- Required: Yes
- Type: string
The name of the role associated with the policy.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'PolicyDocument' => '<string>', 'PolicyName' => '<string>', 'RoleName' => '<string>', ]
Result Details
Members
- PolicyDocument
-
- Required: Yes
- Type: string
The policy document.
IAM stores policies in JSON format. However, resources that were created using CloudFormation templates can be formatted in YAML. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy.
- RoleName
-
- Required: Yes
- Type: string
The role the policy is associated with.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetSAMLProvider
$result = $client->getSAMLProvider
([/* ... */]); $promise = $client->getSAMLProviderAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->getSAMLProvider([ 'SAMLProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- SAMLProviderArn
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the SAML provider resource object in IAM to get information about.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
Result Syntax
[ 'CreateDate' => <DateTime>, 'SAMLMetadataDocument' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'ValidUntil' => <DateTime>, ]
Result Details
Members
- CreateDate
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time when the SAML provider was created.
- SAMLMetadataDocument
-
- Type: string
The XML metadata document that includes information about an identity provider.
- Tags
-
- Type: Array of Tag structures
A list of tags that are attached to the specified IAM SAML provider. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
- ValidUntil
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The expiration date and time for the SAML provider.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetSSHPublicKey
$result = $client->getSSHPublicKey
([/* ... */]); $promise = $client->getSSHPublicKeyAsync
([/* ... */]);
Retrieves the specified SSH public key, including metadata about the key.
The SSH public key retrieved by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.
Parameter Syntax
$result = $client->getSSHPublicKey([ 'Encoding' => 'SSH|PEM', // REQUIRED 'SSHPublicKeyId' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Encoding
-
- Required: Yes
- Type: 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, usePEM
. - SSHPublicKeyId
-
- Required: Yes
- Type: string
The unique identifier for the SSH public key.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
- UserName
-
- Required: Yes
- Type: string
The name of the IAM user associated with the SSH public key.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'SSHPublicKey' => [ 'Fingerprint' => '<string>', 'SSHPublicKeyBody' => '<string>', 'SSHPublicKeyId' => '<string>', 'Status' => 'Active|Inactive', 'UploadDate' => <DateTime>, 'UserName' => '<string>', ], ]
Result Details
Members
- SSHPublicKey
-
- Type: SSHPublicKey structure
A structure containing details about the SSH public key.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- UnrecognizedPublicKeyEncodingException:
The request was rejected because the public key encoding format is unsupported or unrecognized.
GetServerCertificate
$result = $client->getServerCertificate
([/* ... */]); $promise = $client->getServerCertificateAsync
([/* ... */]);
Retrieves information about the specified server certificate stored in IAM.
For more information about working with server certificates, see Working with server certificates in the IAM User Guide. This topic includes a list of Amazon Web Services services that can use the server certificates that you manage with IAM.
Parameter Syntax
$result = $client->getServerCertificate([ 'ServerCertificateName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- ServerCertificateName
-
- Required: Yes
- Type: string
The name of the server certificate you want to retrieve information about.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'ServerCertificate' => [ 'CertificateBody' => '<string>', 'CertificateChain' => '<string>', 'ServerCertificateMetadata' => [ 'Arn' => '<string>', 'Expiration' => <DateTime>, 'Path' => '<string>', 'ServerCertificateId' => '<string>', 'ServerCertificateName' => '<string>', 'UploadDate' => <DateTime>, ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], ]
Result Details
Members
- ServerCertificate
-
- Required: Yes
- Type: ServerCertificate structure
A structure containing details about the server certificate.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetServiceLastAccessedDetails
$result = $client->getServiceLastAccessedDetails
([/* ... */]); $promise = $client->getServiceLastAccessedDetailsAsync
([/* ... */]);
Retrieves a service last accessed report that was created using the GenerateServiceLastAccessedDetails
operation. You can use the JobId
parameter in GetServiceLastAccessedDetails
to retrieve the status of your report job. When the report is complete, you can retrieve the generated report. The report includes a list of Amazon Web Services services that the resource (user, group, role, or managed policy) can access.
Service last accessed data does not use other policy types when determining whether a resource could access a service. These other policy types include resource-based policies, access control lists, Organizations policies, IAM permissions boundaries, and STS assume role policies. It only applies permissions policy logic. For more about the evaluation of policy types, see Evaluating policies in the IAM User Guide.
For each service that the resource could access using permissions policies, the operation returns details about the most recent access attempt. If there was no attempt, the service is listed without details about the most recent attempt to access the service. If the operation fails, the GetServiceLastAccessedDetails
operation returns the reason that it failed.
The GetServiceLastAccessedDetails
operation returns a list of services. This list includes the number of entities that have attempted to access the service and the date and time of the last attempt. It also returns the ARN of the following entity, depending on the resource ARN that you used to generate the report:
-
User – Returns the user ARN that you used to generate the report
-
Group – Returns the ARN of the group member (user) that last attempted to access the service
-
Role – Returns the role ARN that you used to generate the report
-
Policy – Returns the ARN of the user or role that last used the policy to attempt to access the service
By default, the list is sorted by service namespace.
If you specified ACTION_LEVEL
granularity when you generated the report, this operation returns service and action last accessed data. This includes the most recent access attempt for each tracked action within a service. Otherwise, this operation returns only service data.
For more information about service and action last accessed data, see Reducing permissions using service last accessed data in the IAM User Guide.
Parameter Syntax
$result = $client->getServiceLastAccessedDetails([ 'JobId' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- JobId
-
- Required: Yes
- Type: string
The ID of the request generated by the GenerateServiceLastAccessedDetails operation. The
JobId
returned byGenerateServiceLastAccessedDetail
must be used by the same role within a session, or by the same user when used to callGetServiceLastAccessedDetail
. - Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'Error' => [ 'Code' => '<string>', 'Message' => '<string>', ], 'IsTruncated' => true || false, 'JobCompletionDate' => <DateTime>, 'JobCreationDate' => <DateTime>, 'JobStatus' => 'IN_PROGRESS|COMPLETED|FAILED', 'JobType' => 'SERVICE_LEVEL|ACTION_LEVEL', 'Marker' => '<string>', 'ServicesLastAccessed' => [ [ 'LastAuthenticated' => <DateTime>, 'LastAuthenticatedEntity' => '<string>', 'LastAuthenticatedRegion' => '<string>', 'ServiceName' => '<string>', 'ServiceNamespace' => '<string>', 'TotalAuthenticatedEntities' => <integer>, 'TrackedActionsLastAccessed' => [ [ 'ActionName' => '<string>', 'LastAccessedEntity' => '<string>', 'LastAccessedRegion' => '<string>', 'LastAccessedTime' => <DateTime>, ], // ... ], ], // ... ], ]
Result Details
Members
- Error
-
- Type: ErrorDetails structure
An object that contains details about the reason the operation failed.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - JobCompletionDate
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time, in ISO 8601 date-time format, when the generated report job was completed or failed.
This field is null if the job is still in progress, as indicated by a job status value of
IN_PROGRESS
. - JobCreationDate
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time, in ISO 8601 date-time format, when the report job was created.
- JobStatus
-
- Required: Yes
- Type: string
The status of the job.
- JobType
-
- Type: string
The type of job. Service jobs return information about when each service was last accessed. Action jobs also include information about when tracked actions within the service were last accessed.
- Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - ServicesLastAccessed
-
- Required: Yes
- Type: Array of ServiceLastAccessed structures
AÂ
ServiceLastAccessed
object that contains details about the most recent attempt to access the service.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
Examples
Example 1: To get details from a previously-generated report
The following operation gets details about the report with the job ID: examplef-1305-c245-eba4-71fe298bcda7
$result = $client->getServiceLastAccessedDetails([ 'JobId' => 'examplef-1305-c245-eba4-71fe298bcda7', ]);
Result syntax:
[ 'IsTruncated' => , 'JobCompletionDate' =>, 'JobCreationDate' => , 'JobStatus' => 'COMPLETED', 'ServicesLastAccessed' => [ [ 'LastAuthenticated' => , 'LastAuthenticatedEntity' => 'arn:aws:iam::123456789012:user/AWSExampleUser01', 'ServiceName' => 'AWS Identity and Access Management', 'ServiceNamespace' => 'iam', 'TotalAuthenticatedEntities' => 2, ], [ 'ServiceName' => 'Amazon Simple Storage Service', 'ServiceNamespace' => 's3', 'TotalAuthenticatedEntities' => 0, ], ], ]
GetServiceLastAccessedDetailsWithEntities
$result = $client->getServiceLastAccessedDetailsWithEntities
([/* ... */]); $promise = $client->getServiceLastAccessedDetailsWithEntitiesAsync
([/* ... */]);
After you generate a group or policy report using the GenerateServiceLastAccessedDetails
operation, you can use the JobId
parameter in GetServiceLastAccessedDetailsWithEntities
. This operation retrieves the status of your report job and a list of entities that could have used group or policy permissions to access the specified service.
-
Group – For a group report, this operation returns a list of users in the group that could have used the group’s policies in an attempt to access the service.
-
Policy – For a policy report, this operation returns a list of entities (users or roles) that could have used the policy in an attempt to access the service.
You can also use this operation for user or role reports to retrieve details about those entities.
If the operation fails, the GetServiceLastAccessedDetailsWithEntities
operation returns the reason that it failed.
By default, the list of associated entities is sorted by date, with the most recent access listed first.
Parameter Syntax
$result = $client->getServiceLastAccessedDetailsWithEntities([ 'JobId' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, 'ServiceNamespace' => '<string>', // REQUIRED ]);
Parameter Details
Members
- JobId
-
- Required: Yes
- Type: string
The ID of the request generated by the
GenerateServiceLastAccessedDetails
operation. - Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - ServiceNamespace
-
- Required: Yes
- Type: string
The service namespace for an Amazon Web Services service. Provide the service namespace to learn when the IAM entity last attempted to access the specified service.
To learn the service namespace for a service, see Actions, resources, and condition keys for Amazon Web Services services in the IAM User Guide. Choose the name of the service to view details for that service. In the first paragraph, find the service prefix. For example,
(service prefix: a4b)
. For more information about service namespaces, see Amazon Web Services service namespaces in the Amazon Web Services General Reference.
Result Syntax
[ 'EntityDetailsList' => [ [ 'EntityInfo' => [ 'Arn' => '<string>', 'Id' => '<string>', 'Name' => '<string>', 'Path' => '<string>', 'Type' => 'USER|ROLE|GROUP', ], 'LastAuthenticated' => <DateTime>, ], // ... ], 'Error' => [ 'Code' => '<string>', 'Message' => '<string>', ], 'IsTruncated' => true || false, 'JobCompletionDate' => <DateTime>, 'JobCreationDate' => <DateTime>, 'JobStatus' => 'IN_PROGRESS|COMPLETED|FAILED', 'Marker' => '<string>', ]
Result Details
Members
- EntityDetailsList
-
- Required: Yes
- Type: Array of EntityDetails structures
AnÂ
EntityDetailsList
object that contains details about when an IAM entity (user or role) used group or policy permissions in an attempt to access the specified Amazon Web Services service. - Error
-
- Type: ErrorDetails structure
An object that contains details about the reason the operation failed.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - JobCompletionDate
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time, in ISO 8601 date-time format, when the generated report job was completed or failed.
This field is null if the job is still in progress, as indicated by a job status value of
IN_PROGRESS
. - JobCreationDate
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time, in ISO 8601 date-time format, when the report job was created.
- JobStatus
-
- Required: Yes
- Type: string
The status of the job.
- Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
Examples
Example 1: To get sntity details from a previously-generated report
The following operation returns details about the entities that attempted to access the IAM service.
$result = $client->getServiceLastAccessedDetailsWithEntities([ 'JobId' => 'examplef-1305-c245-eba4-71fe298bcda7', 'ServiceNamespace' => 'iam', ]);
Result syntax:
[ 'EntityDetailsList' => [ [ 'EntityInfo' => [ 'Arn' => 'arn:aws:iam::123456789012:user/AWSExampleUser01', 'Id' => 'AIDAEX2EXAMPLEB6IGCDC', 'Name' => 'AWSExampleUser01', 'Path' => '/', 'Type' => 'USER', ], 'LastAuthenticated' =>, ], [ 'EntityInfo' => [ 'Arn' => 'arn:aws:iam::123456789012:role/AWSExampleRole01', 'Id' => 'AROAEAEXAMPLEIANXSIU4', 'Name' => 'AWSExampleRole01', 'Path' => '/', 'Type' => 'ROLE', ], ], ], 'IsTruncated' => , 'JobCompletionDate' => , 'JobCreationDate' => , 'JobStatus' => 'COMPLETED', ]
GetServiceLinkedRoleDeletionStatus
$result = $client->getServiceLinkedRoleDeletionStatus
([/* ... */]); $promise = $client->getServiceLinkedRoleDeletionStatusAsync
([/* ... */]);
Retrieves the status of your service-linked role deletion. After you use DeleteServiceLinkedRole to submit a service-linked role for deletion, you can use the DeletionTaskId
parameter in GetServiceLinkedRoleDeletionStatus
to check the status of the deletion. If the deletion fails, this operation returns the reason that it failed, if that information is returned by the service.
Parameter Syntax
$result = $client->getServiceLinkedRoleDeletionStatus([ 'DeletionTaskId' => '<string>', // REQUIRED ]);
Parameter Details
Members
- DeletionTaskId
-
- Required: Yes
- Type: string
The deletion task identifier. This identifier is returned by the DeleteServiceLinkedRole operation in the format
task/aws-service-role/<service-principal-name>/<role-name>/<task-uuid>
.
Result Syntax
[ 'Reason' => [ 'Reason' => '<string>', 'RoleUsageList' => [ [ 'Region' => '<string>', 'Resources' => ['<string>', ...], ], // ... ], ], 'Status' => 'SUCCEEDED|IN_PROGRESS|FAILED|NOT_STARTED', ]
Result Details
Members
- Reason
-
- Type: DeletionTaskFailureReasonType structure
An object that contains details about the reason the deletion failed.
- Status
-
- Required: Yes
- Type: string
The status of the deletion.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
GetUser
$result = $client->getUser
([/* ... */]); $promise = $client->getUserAsync
([/* ... */]);
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 Amazon Web Services access key ID used to sign the request to this operation.
Parameter Syntax
$result = $client->getUser([ 'UserName' => '<string>', ]);
Parameter Details
Members
- UserName
-
- Type: 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 (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'User' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'PasswordLastUsed' => <DateTime>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', ], ]
Result Details
Members
- User
-
- Required: Yes
- Type: User structure
A structure containing details about the IAM user.
Due to a service issue, password last used data does not include password use from May 3, 2018 22:50 PDT to May 23, 2018 14:08 PDT. This affects last sign-in dates shown in the IAM console and password last used dates in the IAM credential report, and returned by this operation. If users signed in during the affected time, the password last used date that is returned is the date the user last signed in before May 3, 2018. For users that signed in after May 23, 2018 14:08 PDT, the returned password last used date is accurate.
You can use password last used information to identify unused credentials for deletion. For example, you might delete users who did not sign in to Amazon Web Services in the last 90 days. In cases like this, we recommend that you adjust your evaluation window to include dates after May 23, 2018. Alternatively, if your users use access keys to access Amazon Web Services programmatically you can refer to access key last used information because it is accurate for all dates.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To get information about an IAM user
The following command gets information about the IAM user named Bob.
$result = $client->getUser([ 'UserName' => 'Bob', ]);
Result syntax:
[ 'User' => [ 'Arn' => 'arn:aws:iam::123456789012:user/Bob', 'CreateDate' =>, 'Path' => '/', 'UserId' => 'AKIAIOSFODNN7EXAMPLE', 'UserName' => 'Bob', ], ]
GetUserPolicy
$result = $client->getUserPolicy
([/* ... */]); $promise = $client->getUserPolicyAsync
([/* ... */]);
Retrieves the specified inline policy document that is embedded in the specified IAM user.
Policies returned by this operation 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.
Parameter Syntax
$result = $client->getUserPolicy([ 'PolicyName' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy document to get.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- UserName
-
- Required: Yes
- Type: string
The name of the user who the policy is associated with.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'PolicyDocument' => '<string>', 'PolicyName' => '<string>', 'UserName' => '<string>', ]
Result Details
Members
- PolicyDocument
-
- Required: Yes
- Type: string
The policy document.
IAM stores policies in JSON format. However, resources that were created using CloudFormation templates can be formatted in YAML. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy.
- UserName
-
- Required: Yes
- Type: string
The user the policy is associated with.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListAccessKeys
$result = $client->listAccessKeys
([/* ... */]); $promise = $client->listAccessKeysAsync
([/* ... */]);
Returns information about the access key IDs associated with the specified IAM user. If there is none, the operation 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
is not specified, the user name is determined implicitly based on the Amazon Web Services access key ID used to sign the request. If a temporary access key is used, then UserName
is required. If a long-term key is assigned to the user, then UserName
is not required.
This operation works for access keys under the Amazon Web Services account. If the Amazon Web Services account has no associated users, the root user returns it's own access key IDs by running this command.
To ensure the security of your Amazon Web Services account, the secret access key is accessible only during key and user creation.
Parameter Syntax
$result = $client->listAccessKeys([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Type: string
The name of the user.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'AccessKeyMetadata' => [ [ 'AccessKeyId' => '<string>', 'CreateDate' => <DateTime>, 'Status' => 'Active|Inactive', 'UserName' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- AccessKeyMetadata
-
- Required: Yes
- Type: Array of AccessKeyMetadata structures
A list of objects containing metadata about the access keys.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list the access key IDs for an IAM user
The following command lists the access keys IDs for the IAM user named Alice.
$result = $client->listAccessKeys([ 'UserName' => 'Alice', ]);
Result syntax:
[ 'AccessKeyMetadata' => [ [ 'AccessKeyId' => 'AKIA111111111EXAMPLE', 'CreateDate' =>, 'Status' => 'Active', 'UserName' => 'Alice', ], [ 'AccessKeyId' => 'AKIA222222222EXAMPLE', 'CreateDate' => , 'Status' => 'Active', 'UserName' => 'Alice', ], ], ]
ListAccountAliases
$result = $client->listAccountAliases
([/* ... */]); $promise = $client->listAccountAliasesAsync
([/* ... */]);
Lists the account alias associated with the Amazon Web Services account (Note: you can have only one). For information about using an Amazon Web Services account alias, see Creating, deleting, and listing an Amazon Web Services account alias in the IAM User Guide.
Parameter Syntax
$result = $client->listAccountAliases([ 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'AccountAliases' => ['<string>', ...], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- AccountAliases
-
- Required: Yes
- Type: Array of strings
A list of aliases associated with the account. Amazon Web Services supports only one alias per account.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list account aliases
The following command lists the aliases for the current account.
$result = $client->listAccountAliases([ ]);
Result syntax:
[ 'AccountAliases' => [ 'exmaple-corporation', ], ]
ListAttachedGroupPolicies
$result = $client->listAttachedGroupPolicies
([/* ... */]); $promise = $client->listAttachedGroupPoliciesAsync
([/* ... */]);
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 ListGroupPolicies. 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 operation returns an empty list.
Parameter Syntax
$result = $client->listAttachedGroupPolicies([ 'GroupName' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the group to list attached policies for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'AttachedPolicies' => [ [ 'PolicyArn' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- AttachedPolicies
-
- Type: Array of AttachedPolicy structures
A list of the attached policies.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListAttachedRolePolicies
$result = $client->listAttachedRolePolicies
([/* ... */]); $promise = $client->listAttachedRolePoliciesAsync
([/* ... */]);
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 ListRolePolicies. 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 operation returns an empty list.
Parameter Syntax
$result = $client->listAttachedRolePolicies([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - RoleName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the role to list attached policies for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'AttachedPolicies' => [ [ 'PolicyArn' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- AttachedPolicies
-
- Type: Array of AttachedPolicy structures
A list of the attached policies.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListAttachedUserPolicies
$result = $client->listAttachedUserPolicies
([/* ... */]); $promise = $client->listAttachedUserPoliciesAsync
([/* ... */]);
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 ListUserPolicies. 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 operation returns an empty list.
Parameter Syntax
$result = $client->listAttachedUserPolicies([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - UserName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the user to list attached policies for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'AttachedPolicies' => [ [ 'PolicyArn' => '<string>', 'PolicyName' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- AttachedPolicies
-
- Type: Array of AttachedPolicy structures
A list of the attached policies.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListEntitiesForPolicy
$result = $client->listEntitiesForPolicy
([/* ... */]); $promise = $client->listEntitiesForPolicyAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->listEntitiesForPolicy([ 'EntityFilter' => 'User|Role|Group|LocalManagedPolicy|AWSManagedPolicy', 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', 'PolicyArn' => '<string>', // REQUIRED 'PolicyUsageFilter' => 'PermissionsPolicy|PermissionsBoundary', ]);
Parameter Details
Members
- EntityFilter
-
- Type: string
The entity type to use for filtering the results.
For example, when
EntityFilter
isRole
, 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. - Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
- PolicyUsageFilter
-
- Type: string
The policy usage method to use for filtering the results.
To list only permissions policies, setÂ
PolicyUsageFilter
 toÂPermissionsPolicy
. To list only the policies used to set permissions boundaries, set the value toÂPermissionsBoundary
.This parameter is optional. If it is not included, all policies are returned.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'PolicyGroups' => [ [ 'GroupId' => '<string>', 'GroupName' => '<string>', ], // ... ], 'PolicyRoles' => [ [ 'RoleId' => '<string>', 'RoleName' => '<string>', ], // ... ], 'PolicyUsers' => [ [ 'UserId' => '<string>', 'UserName' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - PolicyGroups
-
- Type: Array of PolicyGroup structures
A list of IAM groups that the policy is attached to.
- PolicyRoles
-
- Type: Array of PolicyRole structures
A list of IAM roles that the policy is attached to.
- PolicyUsers
-
- Type: Array of PolicyUser structures
A list of IAM users that the policy is attached to.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListGroupPolicies
$result = $client->listGroupPolicies
([/* ... */]); $promise = $client->listGroupPoliciesAsync
([/* ... */]);
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 operation returns an empty list.
Parameter Syntax
$result = $client->listGroupPolicies([ 'GroupName' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group to list policies for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'PolicyNames' => ['<string>', ...], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - PolicyNames
-
- Required: Yes
- Type: Array of strings
A list of policy names.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: 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.
$result = $client->listGroupPolicies([ 'GroupName' => 'Admins', ]);
Result syntax:
[ 'PolicyNames' => [ 'AdminRoot', 'KeyPolicy', ], ]
ListGroups
$result = $client->listGroups
([/* ... */]); $promise = $client->listGroupsAsync
([/* ... */]);
Lists the IAM groups that have the specified path prefix.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listGroups([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'Groups' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'GroupId' => '<string>', 'GroupName' => '<string>', 'Path' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- Groups
-
- Required: Yes
- Type: Array of Group structures
A list of groups.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list the IAM groups for the current account
The following command lists the IAM groups in the current account:
$result = $client->listGroups([ ]);
Result syntax:
[ 'Groups' => [ [ 'Arn' => 'arn:aws:iam::123456789012:group/Admins', 'CreateDate' =>, 'GroupId' => 'AGPA1111111111EXAMPLE', 'GroupName' => 'Admins', 'Path' => '/division_abc/subdivision_xyz/', ], [ 'Arn' => 'arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test', 'CreateDate' => , 'GroupId' => 'AGP22222222222EXAMPLE', 'GroupName' => 'Test', 'Path' => '/division_abc/subdivision_xyz/product_1234/engineering/', ], [ 'Arn' => 'arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers', 'CreateDate' => , 'GroupId' => 'AGPI3333333333EXAMPLE', 'GroupName' => 'Managers', 'Path' => '/division_abc/subdivision_xyz/product_1234/', ], ], ]
ListGroupsForUser
$result = $client->listGroupsForUser
([/* ... */]); $promise = $client->listGroupsForUserAsync
([/* ... */]);
Lists the IAM groups that the specified IAM user belongs to.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listGroupsForUser([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Required: Yes
- Type: string
The name of the user to list groups for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'Groups' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'GroupId' => '<string>', 'GroupName' => '<string>', 'Path' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- Groups
-
- Required: Yes
- Type: Array of Group structures
A list of groups.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list the groups that an IAM user belongs to
The following command displays the groups that the IAM user named Bob belongs to.
$result = $client->listGroupsForUser([ 'UserName' => 'Bob', ]);
Result syntax:
[ 'Groups' => [ [ 'Arn' => 'arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test', 'CreateDate' =>, 'GroupId' => 'AGP2111111111EXAMPLE', 'GroupName' => 'Test', 'Path' => '/division_abc/subdivision_xyz/product_1234/engineering/', ], [ 'Arn' => 'arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers', 'CreateDate' => , 'GroupId' => 'AGPI222222222SEXAMPLE', 'GroupName' => 'Managers', 'Path' => '/division_abc/subdivision_xyz/product_1234/', ], ], ]
ListInstanceProfileTags
$result = $client->listInstanceProfileTags
([/* ... */]); $promise = $client->listInstanceProfileTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified IAM instance profile. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listInstanceProfileTags([ 'InstanceProfileName' => '<string>', // REQUIRED 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the IAM instance profile whose tags you want to see.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the IAM instance profile. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListInstanceProfiles
$result = $client->listInstanceProfiles
([/* ... */]); $promise = $client->listInstanceProfilesAsync
([/* ... */]);
Lists the instance profiles that have the specified path prefix. If there are none, the operation returns an empty list. For more information about instance profiles, see Using instance profiles in the IAM User Guide.
IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view all of the information for an instance profile, see GetInstanceProfile.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listInstanceProfiles([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'InstanceProfiles' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'InstanceProfileId' => '<string>', 'InstanceProfileName' => '<string>', 'Path' => '<string>', 'Roles' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- InstanceProfiles
-
- Required: Yes
- Type: Array of InstanceProfile structures
A list of instance profiles.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListInstanceProfilesForRole
$result = $client->listInstanceProfilesForRole
([/* ... */]); $promise = $client->listInstanceProfilesForRoleAsync
([/* ... */]);
Lists the instance profiles that have the specified associated IAM role. If there are none, the operation returns an empty list. For more information about instance profiles, go to Using instance profiles in the IAM User Guide.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listInstanceProfilesForRole([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - RoleName
-
- Required: Yes
- Type: string
The name of the role to list instance profiles for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'InstanceProfiles' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'InstanceProfileId' => '<string>', 'InstanceProfileName' => '<string>', 'Path' => '<string>', 'Roles' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- InstanceProfiles
-
- Required: Yes
- Type: Array of InstanceProfile structures
A list of instance profiles.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListMFADeviceTags
$result = $client->listMFADeviceTags
([/* ... */]); $promise = $client->listMFADeviceTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified IAM virtual multi-factor authentication (MFA) device. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listMFADeviceTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'SerialNumber' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - SerialNumber
-
- Required: Yes
- Type: string
The unique identifier for the IAM virtual MFA device whose tags you want to see. For virtual MFA devices, the serial number is the same as the ARN.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the virtual MFA device. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListMFADevices
$result = $client->listMFADevices
([/* ... */]); $promise = $client->listMFADevicesAsync
([/* ... */]);
Lists the MFA devices for an IAM user. If the request includes a IAM user name, then this operation 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 Amazon Web Services access key ID signing the request for this operation.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listMFADevices([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Type: string
The name of the user whose MFA devices you want to list.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'MFADevices' => [ [ 'EnableDate' => <DateTime>, 'SerialNumber' => '<string>', 'UserName' => '<string>', ], // ... ], 'Marker' => '<string>', ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - MFADevices
-
- Required: Yes
- Type: Array of MFADevice structures
A list of MFA devices.
- Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListOpenIDConnectProviderTags
$result = $client->listOpenIDConnectProviderTags
([/* ... */]); $promise = $client->listOpenIDConnectProviderTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified OpenID Connect (OIDC)-compatible identity provider. The returned list of tags is sorted by tag key. For more information, see About web identity federation.
For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listOpenIDConnectProviderTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'OpenIDConnectProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - OpenIDConnectProviderArn
-
- Required: Yes
- Type: string
The ARN of the OpenID Connect (OIDC) identity provider whose tags you want to see.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the OpenID Connect (OIDC) identity provider. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
ListOpenIDConnectProviders
$result = $client->listOpenIDConnectProviders
([/* ... */]); $promise = $client->listOpenIDConnectProvidersAsync
([/* ... */]);
Lists information about the IAM OpenID Connect (OIDC) provider resource objects defined in the Amazon Web Services account.
IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view all of the information for an OIDC provider, see GetOpenIDConnectProvider.
Parameter Syntax
$result = $client->listOpenIDConnectProviders([ ]);
Parameter Details
Members
Result Syntax
[ 'OpenIDConnectProviderList' => [ [ 'Arn' => '<string>', ], // ... ], ]
Result Details
Members
- OpenIDConnectProviderList
-
- Type: Array of OpenIDConnectProviderListEntry structures
The list of IAM OIDC provider resource objects defined in the Amazon Web Services account.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListPolicies
$result = $client->listPolicies
([/* ... */]); $promise = $client->listPoliciesAsync
([/* ... */]);
Lists all the managed policies that are available in your Amazon Web Services account, including your own customer-defined managed policies and all Amazon Web Services 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 Amazon Web Services account, set Scope
to Local
. To list only Amazon Web Services 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.
IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view all of the information for a customer manged policy, see GetPolicy.
Parameter Syntax
$result = $client->listPolicies([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'OnlyAttached' => true || false, 'PathPrefix' => '<string>', 'PolicyUsageFilter' => 'PermissionsPolicy|PermissionsBoundary', 'Scope' => 'All|AWS|Local', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - OnlyAttached
-
- Type: boolean
A flag to filter the results to only the attached policies.
When
OnlyAttached
istrue
, the returned list contains only the policies that are attached to an IAM user, group, or role. WhenOnlyAttached
isfalse
, or when the parameter is not included, all policies are returned. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters. - PolicyUsageFilter
-
- Type: string
The policy usage method to use for filtering the results.
To list only permissions policies, setÂ
PolicyUsageFilter
 toÂPermissionsPolicy
. To list only the policies used to set permissions boundaries, set the value toÂPermissionsBoundary
.This parameter is optional. If it is not included, all policies are returned.
- Scope
-
- Type: string
The scope to use for filtering the results.
To list only Amazon Web Services managed policies, set
Scope
toAWS
. To list only the customer managed policies in your Amazon Web Services account, setScope
toLocal
.This parameter is optional. If it is not included, or if it is set to
All
, all policies are returned.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Policies' => [ [ 'Arn' => '<string>', 'AttachmentCount' => <integer>, 'CreateDate' => <DateTime>, 'DefaultVersionId' => '<string>', 'Description' => '<string>', 'IsAttachable' => true || false, 'Path' => '<string>', 'PermissionsBoundaryUsageCount' => <integer>, 'PolicyId' => '<string>', 'PolicyName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UpdateDate' => <DateTime>, ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Policies
-
- Type: Array of Policy structures
A list of policies.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListPoliciesGrantingServiceAccess
$result = $client->listPoliciesGrantingServiceAccess
([/* ... */]); $promise = $client->listPoliciesGrantingServiceAccessAsync
([/* ... */]);
Retrieves a list of policies that the IAM identity (user, group, or role) can use to access each specified service.
This operation does not use other policy types when determining whether a resource could access a service. These other policy types include resource-based policies, access control lists, Organizations policies, IAM permissions boundaries, and STS assume role policies. It only applies permissions policy logic. For more about the evaluation of policy types, see Evaluating policies in the IAM User Guide.
The list of policies returned by the operation depends on the ARN of the identity that you provide.
-
User – The list of policies includes the managed and inline policies that are attached to the user directly. The list also includes any additional managed and inline policies that are attached to the group to which the user belongs.
-
Group – The list of policies includes only the managed and inline policies that are attached to the group directly. Policies that are attached to the group’s user are not included.
-
Role – The list of policies includes only the managed and inline policies that are attached to the role.
For each managed policy, this operation returns the ARN and policy name. For each inline policy, it returns the policy name and the entity to which it is attached. Inline policies do not have an ARN. For more information about these policy types, see Managed policies and inline policies in the IAM User Guide.
Policies that are attached to users and roles as permissions boundaries are not returned. To view which managed policy is currently used to set the permissions boundary for a user or role, use the GetUser or GetRole operations.
Parameter Syntax
$result = $client->listPoliciesGrantingServiceAccess([ 'Arn' => '<string>', // REQUIRED 'Marker' => '<string>', 'ServiceNamespaces' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- Arn
-
- Required: Yes
- Type: string
The ARN of the IAM identity (user, group, or role) whose policies you want to list.
- Marker
-
- Type: 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. - ServiceNamespaces
-
- Required: Yes
- Type: Array of strings
The service namespace for the Amazon Web Services services whose policies you want to list.
To learn the service namespace for a service, see Actions, resources, and condition keys for Amazon Web Services services in the IAM User Guide. Choose the name of the service to view details for that service. In the first paragraph, find the service prefix. For example,
(service prefix: a4b)
. For more information about service namespaces, see Amazon Web Services service namespaces in the Amazon Web Services General Reference.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'PoliciesGrantingServiceAccess' => [ [ 'Policies' => [ [ 'EntityName' => '<string>', 'EntityType' => 'USER|ROLE|GROUP', 'PolicyArn' => '<string>', 'PolicyName' => '<string>', 'PolicyType' => 'INLINE|MANAGED', ], // ... ], 'ServiceNamespace' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - PoliciesGrantingServiceAccess
-
- Required: Yes
- Type: Array of ListPoliciesGrantingServiceAccessEntry structures
AÂ
ListPoliciesGrantingServiceAccess
object that contains details about the permissions policies attached to the specified identity (user, group, or role).
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
Examples
Example 1: To list policies that allow access to a service
The following operation lists policies that allow ExampleUser01 to access IAM or EC2.
$result = $client->listPoliciesGrantingServiceAccess([ 'Arn' => 'arn:aws:iam::123456789012:user/ExampleUser01', 'ServiceNamespaces' => [ 'iam', 'ec2', ], ]);
Result syntax:
[ 'IsTruncated' => , 'PoliciesGrantingServiceAccess' => [ [ 'Policies' => [ [ 'PolicyArn' => 'arn:aws:iam::123456789012:policy/ExampleIamPolicy', 'PolicyName' => 'ExampleIamPolicy', 'PolicyType' => 'MANAGED', ], [ 'EntityName' => 'AWSExampleGroup1', 'EntityType' => 'GROUP', 'PolicyName' => 'ExampleGroup1Policy', 'PolicyType' => 'INLINE', ], ], 'ServiceNamespace' => 'iam', ], [ 'Policies' => [ [ 'PolicyArn' => 'arn:aws:iam::123456789012:policy/ExampleEc2Policy', 'PolicyName' => 'ExampleEc2Policy', 'PolicyType' => 'MANAGED', ], ], 'ServiceNamespace' => 'ec2', ], ], ]
ListPolicyTags
$result = $client->listPolicyTags
([/* ... */]); $promise = $client->listPolicyTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified IAM customer managed policy. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listPolicyTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PolicyArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PolicyArn
-
- Required: Yes
- Type: string
The ARN of the IAM customer managed policy whose tags you want to see.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the IAM customer managed policy. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
ListPolicyVersions
$result = $client->listPolicyVersions
([/* ... */]); $promise = $client->listPolicyVersionsAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->listPolicyVersions([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PolicyArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Versions' => [ [ 'CreateDate' => <DateTime>, 'Document' => '<string>', 'IsDefaultVersion' => true || false, 'VersionId' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Versions
-
- Type: Array of PolicyVersion structures
A list of policy versions.
For more information about managed policy versions, see Versioning for managed policies in the IAM User Guide.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListRolePolicies
$result = $client->listRolePolicies
([/* ... */]); $promise = $client->listRolePoliciesAsync
([/* ... */]);
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 operation returns an empty list.
Parameter Syntax
$result = $client->listRolePolicies([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - RoleName
-
- Required: Yes
- Type: string
The name of the role to list policies for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'PolicyNames' => ['<string>', ...], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - PolicyNames
-
- Required: Yes
- Type: Array of strings
A list of policy names.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListRoleTags
$result = $client->listRoleTags
([/* ... */]); $promise = $client->listRoleTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified role. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listRoleTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - RoleName
-
- Required: Yes
- Type: string
The name of the IAM role for which you want to see the list of tags.
This parameter accepts (through its regex pattern) a string of characters that consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the role. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list the tags attached to an IAM role
The following example shows how to list the tags attached to a role.
$result = $client->listRoleTags([ 'RoleName' => 'taggedrole1', ]);
Result syntax:
[ 'IsTruncated' => , 'Tags' => [ [ 'Key' => 'Dept', 'Value' => '12345', ], [ 'Key' => 'Team', 'Value' => 'Accounting', ], ], ]
ListRoles
$result = $client->listRoles
([/* ... */]); $promise = $client->listRolesAsync
([/* ... */]);
Lists the IAM roles that have the specified path prefix. If there are none, the operation returns an empty list. For more information about roles, see IAM roles in the IAM User Guide.
IAM resource-listing operations return a subset of the available attributes for the resource. This operation does not return the following attributes, even though they are an attribute of the returned object:
-
PermissionsBoundary
-
RoleLastUsed
-
Tags
To view all of the information for a role, see GetRole.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listRoles([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Roles' => [ [ 'Arn' => '<string>', 'AssumeRolePolicyDocument' => '<string>', 'CreateDate' => <DateTime>, 'Description' => '<string>', 'MaxSessionDuration' => <integer>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'RoleId' => '<string>', 'RoleLastUsed' => [ 'LastUsedDate' => <DateTime>, 'Region' => '<string>', ], 'RoleName' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Roles
-
- Required: Yes
- Type: Array of Role structures
A list of roles.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListSAMLProviderTags
$result = $client->listSAMLProviderTags
([/* ... */]); $promise = $client->listSAMLProviderTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified Security Assertion Markup Language (SAML) identity provider. The returned list of tags is sorted by tag key. For more information, see About SAML 2.0-based federation.
For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listSAMLProviderTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'SAMLProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - SAMLProviderArn
-
- Required: Yes
- Type: string
The ARN of the Security Assertion Markup Language (SAML) identity provider whose tags you want to see.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the Security Assertion Markup Language (SAML) identity provider. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
ListSAMLProviders
$result = $client->listSAMLProviders
([/* ... */]); $promise = $client->listSAMLProvidersAsync
([/* ... */]);
Lists the SAML provider resource objects defined in IAM in the account. IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view all of the information for a SAML provider, see GetSAMLProvider.
This operation requires Signature Version 4.
Parameter Syntax
$result = $client->listSAMLProviders([ ]);
Parameter Details
Members
Result Syntax
[ 'SAMLProviderList' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'ValidUntil' => <DateTime>, ], // ... ], ]
Result Details
Members
- SAMLProviderList
-
- Type: Array of SAMLProviderListEntry structures
The list of SAML provider resource objects defined in IAM for this Amazon Web Services account.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListSSHPublicKeys
$result = $client->listSSHPublicKeys
([/* ... */]); $promise = $client->listSSHPublicKeysAsync
([/* ... */]);
Returns information about the SSH public keys associated with the specified IAM user. If none exists, the operation returns an empty list.
The SSH public keys returned by this operation are used only for authenticating the IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the 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.
Parameter Syntax
$result = $client->listSSHPublicKeys([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Type: 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 Amazon Web Services access key used to sign the request.This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'SSHPublicKeys' => [ [ 'SSHPublicKeyId' => '<string>', 'Status' => 'Active|Inactive', 'UploadDate' => <DateTime>, 'UserName' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - SSHPublicKeys
-
- Type: Array of SSHPublicKeyMetadata structures
A list of the SSH public keys assigned to IAM user.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
ListServerCertificateTags
$result = $client->listServerCertificateTags
([/* ... */]); $promise = $client->listServerCertificateTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified IAM server certificate. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
For certificates in a Region supported by Certificate Manager (ACM), we recommend that you don't use IAM server certificates. Instead, use ACM to provision, manage, and deploy your server certificates. For more information about IAM server certificates, Working with server certificates in the IAM User Guide.
Parameter Syntax
$result = $client->listServerCertificateTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'ServerCertificateName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - ServerCertificateName
-
- Required: Yes
- Type: string
The name of the IAM server certificate whose tags you want to see.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the IAM server certificate. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListServerCertificates
$result = $client->listServerCertificates
([/* ... */]); $promise = $client->listServerCertificatesAsync
([/* ... */]);
Lists the server certificates stored in IAM that have the specified path prefix. If none exist, the operation returns an empty list.
You can paginate the results using the MaxItems
and Marker
parameters.
For more information about working with server certificates, see Working with server certificates in the IAM User Guide. This topic also includes a list of Amazon Web Services services that can use the server certificates that you manage with IAM.
IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view all of the information for a servercertificate, see GetServerCertificate.
Parameter Syntax
$result = $client->listServerCertificates([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'ServerCertificateMetadataList' => [ [ 'Arn' => '<string>', 'Expiration' => <DateTime>, 'Path' => '<string>', 'ServerCertificateId' => '<string>', 'ServerCertificateName' => '<string>', 'UploadDate' => <DateTime>, ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - ServerCertificateMetadataList
-
- Required: Yes
- Type: Array of ServerCertificateMetadata structures
A list of server certificates.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListServiceSpecificCredentials
$result = $client->listServiceSpecificCredentials
([/* ... */]); $promise = $client->listServiceSpecificCredentialsAsync
([/* ... */]);
Returns information about the service-specific credentials associated with the specified IAM user. If none exists, the operation returns an empty list. The service-specific credentials returned by this operation are used only for authenticating the IAM user to a specific service. For more information about using service-specific credentials to authenticate to an Amazon Web Services service, see Set up service-specific credentials in the CodeCommit User Guide.
Parameter Syntax
$result = $client->listServiceSpecificCredentials([ 'ServiceName' => '<string>', 'UserName' => '<string>', ]);
Parameter Details
Members
- ServiceName
-
- Type: string
Filters the returned results to only those for the specified Amazon Web Services service. If not specified, then Amazon Web Services returns service-specific credentials for all services.
- UserName
-
- Type: 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 (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'ServiceSpecificCredentials' => [ [ 'CreateDate' => <DateTime>, 'ServiceName' => '<string>', 'ServiceSpecificCredentialId' => '<string>', 'ServiceUserName' => '<string>', 'Status' => 'Active|Inactive', 'UserName' => '<string>', ], // ... ], ]
Result Details
Members
- ServiceSpecificCredentials
-
- Type: Array of ServiceSpecificCredentialMetadata structures
A list of structures that each contain details about a service-specific credential.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceNotSupportedException:
The specified service does not support service-specific credentials.
ListSigningCertificates
$result = $client->listSigningCertificates
([/* ... */]); $promise = $client->listSigningCertificatesAsync
([/* ... */]);
Returns information about the signing certificates associated with the specified IAM user. If none exists, the operation 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 Amazon Web Services access key ID used to sign the request for this operation. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials even if the Amazon Web Services account has no associated users.
Parameter Syntax
$result = $client->listSigningCertificates([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Type: string
The name of the IAM user whose signing certificates you want to examine.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'Certificates' => [ [ 'CertificateBody' => '<string>', 'CertificateId' => '<string>', 'Status' => 'Active|Inactive', 'UploadDate' => <DateTime>, 'UserName' => '<string>', ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- Certificates
-
- Required: Yes
- Type: Array of SigningCertificate structures
A list of the user's signing certificate information.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list the signing certificates for an IAM user
The following command lists the signing certificates for the IAM user named Bob.
$result = $client->listSigningCertificates([ 'UserName' => 'Bob', ]);
Result syntax:
[ 'Certificates' => [ [ 'CertificateBody' => '-----BEGIN CERTIFICATE----------END CERTIFICATE-----', 'CertificateId' => 'TA7SMP42TDN5Z26OBPJE7EXAMPLE', 'Status' => 'Active', 'UploadDate' => , 'UserName' => 'Bob', ], ], ]
ListUserPolicies
$result = $client->listUserPolicies
([/* ... */]); $promise = $client->listUserPoliciesAsync
([/* ... */]);
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 operation returns an empty list.
Parameter Syntax
$result = $client->listUserPolicies([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Required: Yes
- Type: string
The name of the user to list policies for.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'PolicyNames' => ['<string>', ...], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - PolicyNames
-
- Required: Yes
- Type: Array of strings
A list of policy names.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
ListUserTags
$result = $client->listUserTags
([/* ... */]); $promise = $client->listUserTagsAsync
([/* ... */]);
Lists the tags that are attached to the specified IAM user. The returned list of tags is sorted by tag key. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->listUserTags([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - UserName
-
- Required: Yes
- Type: string
The name of the IAM user whose tags you want to see.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that are currently attached to the user. Each tag consists of a key name and an associated value. If no tags are attached to the specified resource, the response contains an empty list.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list the tags attached to an IAM user
The following example shows how to list the tags attached to a user.
$result = $client->listUserTags([ 'UserName' => 'anika', ]);
Result syntax:
[ 'IsTruncated' => , 'Tags' => [ [ 'Key' => 'Dept', 'Value' => '12345', ], [ 'Key' => 'Team', 'Value' => 'Accounting', ], ], ]
ListUsers
$result = $client->listUsers
([/* ... */]); $promise = $client->listUsersAsync
([/* ... */]);
Lists the IAM users that have the specified path prefix. If no path prefix is specified, the operation returns all users in the Amazon Web Services account. If there are none, the operation returns an empty list.
IAM resource-listing operations return a subset of the available attributes for the resource. This operation does not return the following attributes, even though they are an attribute of the returned object:
-
PermissionsBoundary
-
Tags
To view all of the information for a user, see GetUser.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listUsers([ 'Marker' => '<string>', 'MaxItems' => <integer>, 'PathPrefix' => '<string>', ]);
Parameter Details
Members
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PathPrefix
-
- Type: 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 parameter allows (through 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. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'Users' => [ [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'PasswordLastUsed' => <DateTime>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - Users
-
- Required: Yes
- Type: Array of User structures
A list of users.
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To list IAM users
The following command lists the IAM users in the current account.
$result = $client->listUsers([ ]);
Result syntax:
[ 'Users' => [ [ 'Arn' => 'arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/engineering/Juan', 'CreateDate' =>, 'PasswordLastUsed' => , 'Path' => '/division_abc/subdivision_xyz/engineering/', 'UserId' => 'AID2MAB8DPLSRHEXAMPLE', 'UserName' => 'Juan', ], [ 'Arn' => 'arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/engineering/Anika', 'CreateDate' => , 'PasswordLastUsed' => , 'Path' => '/division_abc/subdivision_xyz/engineering/', 'UserId' => 'AIDIODR4TAW7CSEXAMPLE', 'UserName' => 'Anika', ], ], ]
ListVirtualMFADevices
$result = $client->listVirtualMFADevices
([/* ... */]); $promise = $client->listVirtualMFADevicesAsync
([/* ... */]);
Lists the virtual MFA devices defined in the Amazon Web Services account by assignment status. If you do not specify an assignment status, the operation returns a list of all virtual MFA devices. Assignment status can be Assigned
, Unassigned
, or Any
.
IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view tag information for a virtual MFA device, see ListMFADeviceTags.
You can paginate the results using the MaxItems
and Marker
parameters.
Parameter Syntax
$result = $client->listVirtualMFADevices([ 'AssignmentStatus' => 'Assigned|Unassigned|Any', 'Marker' => '<string>', 'MaxItems' => <integer>, ]);
Parameter Details
Members
- AssignmentStatus
-
- Type: string
The status (
Unassigned
orAssigned
) of the devices to list. If you do not specify anAssignmentStatus
, the operation defaults toAny
, which lists both assigned and unassigned virtual MFA devices., - Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from.
Result Syntax
[ 'IsTruncated' => true || false, 'Marker' => '<string>', 'VirtualMFADevices' => [ [ 'Base32StringSeed' => <string || resource || Psr\Http\Message\StreamInterface>, 'EnableDate' => <DateTime>, 'QRCodePNG' => <string || resource || Psr\Http\Message\StreamInterface>, 'SerialNumber' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'User' => [ 'Arn' => '<string>', 'CreateDate' => <DateTime>, 'PasswordLastUsed' => <DateTime>, 'Path' => '<string>', 'PermissionsBoundary' => [ 'PermissionsBoundaryArn' => '<string>', 'PermissionsBoundaryType' => 'PermissionsBoundaryPolicy', ], 'Tags' => [ [ 'Key' => '<string>', 'Value' => '<string>', ], // ... ], 'UserId' => '<string>', 'UserName' => '<string>', ], ], // ... ], ]
Result Details
Members
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request. - VirtualMFADevices
-
- Required: Yes
- Type: Array of VirtualMFADevice structures
The list of virtual MFA devices in the current account that match the
AssignmentStatus
value that was passed in the request.
Errors
There are no errors described for this operation.
Examples
Example 1: To list virtual MFA devices
The following command lists the virtual MFA devices that have been configured for the current account.
$result = $client->listVirtualMFADevices([ ]);
Result syntax:
[ 'VirtualMFADevices' => [ [ 'SerialNumber' => 'arn:aws:iam::123456789012:mfa/ExampleMFADevice', ], [ 'SerialNumber' => 'arn:aws:iam::123456789012:mfa/Juan', ], ], ]
PutGroupPolicy
$result = $client->putGroupPolicy
([/* ... */]); $promise = $client->putGroupPolicyAsync
([/* ... */]);
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 the maximum number of inline policies that you can embed in a group, see IAM and STS quotas 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, see Making query requests in the IAM User Guide.
Parameter Syntax
$result = $client->putGroupPolicy([ 'GroupName' => '<string>', // REQUIRED 'PolicyDocument' => '<string>', // REQUIRED 'PolicyName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group to associate the policy with.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-.
- PolicyDocument
-
- Required: Yes
- Type: string
The policy document.
You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy document.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To add a policy to a group
The following command adds a policy named AllPerms to the IAM group named Admins.
$result = $client->putGroupPolicy([ 'GroupName' => 'Admins', 'PolicyDocument' => '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"*","Resource":"*"}}', 'PolicyName' => 'AllPerms', ]);
PutRolePermissionsBoundary
$result = $client->putRolePermissionsBoundary
([/* ... */]); $promise = $client->putRolePermissionsBoundaryAsync
([/* ... */]);
Adds or updates the policy that is specified as the IAM role's permissions boundary. You can use an Amazon Web Services managed policy or a customer managed policy to set the boundary for a role. Use the boundary to control the maximum permissions that the role can have. Setting a permissions boundary is an advanced feature that can affect the permissions for the role.
You cannot set the boundary for a service-linked role.
Policies used as permissions boundaries do not provide permissions. You must also attach a permissions policy to the role. To learn how the effective permissions for a role are evaluated, see IAM JSON policy evaluation logic in the IAM User Guide.
Parameter Syntax
$result = $client->putRolePermissionsBoundary([ 'PermissionsBoundary' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PermissionsBoundary
-
- Required: Yes
- Type: string
The ARN of the managed policy that is used to set the permissions boundary for the role.
A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see Permissions boundaries for IAM entities in the IAM User Guide.
For more information about policy types, see Policy types in the IAM User Guide.
- RoleName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM role for which you want to set the permissions boundary.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- PolicyNotAttachableException:
The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
PutRolePolicy
$result = $client->putRolePolicy
([/* ... */]); $promise = $client->putRolePolicyAsync
([/* ... */]);
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 roles, see IAM roles in the IAM User Guide.
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 the maximum number of inline policies that you can embed with a role, see IAM and STS quotas 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, see Making query requests in the IAM User Guide.
Parameter Syntax
$result = $client->putRolePolicy([ 'PolicyDocument' => '<string>', // REQUIRED 'PolicyName' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyDocument
-
- Required: Yes
- Type: string
The policy document.
You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy document.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- RoleName
-
- Required: Yes
- Type: string
The name of the role to associate the policy with.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To attach a permissions policy to an IAM role
The following command adds a permissions policy to the role named Test-Role.
$result = $client->putRolePolicy([ 'PolicyDocument' => '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"s3:*","Resource":"*"}}', 'PolicyName' => 'S3AccessPolicy', 'RoleName' => 'S3Access', ]);
PutUserPermissionsBoundary
$result = $client->putUserPermissionsBoundary
([/* ... */]); $promise = $client->putUserPermissionsBoundaryAsync
([/* ... */]);
Adds or updates the policy that is specified as the IAM user's permissions boundary. You can use an Amazon Web Services managed policy or a customer managed policy to set the boundary for a user. Use the boundary to control the maximum permissions that the user can have. Setting a permissions boundary is an advanced feature that can affect the permissions for the user.
Policies that are used as permissions boundaries do not provide permissions. You must also attach a permissions policy to the user. To learn how the effective permissions for a user are evaluated, see IAM JSON policy evaluation logic in the IAM User Guide.
Parameter Syntax
$result = $client->putUserPermissionsBoundary([ 'PermissionsBoundary' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PermissionsBoundary
-
- Required: Yes
- Type: string
The ARN of the managed policy that is used to set the permissions boundary for the user.
A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see Permissions boundaries for IAM entities in the IAM User Guide.
For more information about policy types, see Policy types in the IAM User Guide.
- UserName
-
- Required: Yes
- Type: string
The name (friendly name, not ARN) of the IAM user for which you want to set the permissions boundary.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- PolicyNotAttachableException:
The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
PutUserPolicy
$result = $client->putUserPolicy
([/* ... */]); $promise = $client->putUserPolicyAsync
([/* ... */]);
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 the maximum number of inline policies that you can embed in a user, see IAM and STS quotas 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, see Making query requests in the IAM User Guide.
Parameter Syntax
$result = $client->putUserPolicy([ 'PolicyDocument' => '<string>', // REQUIRED 'PolicyName' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyDocument
-
- Required: Yes
- Type: string
The policy document.
You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicyName
-
- Required: Yes
- Type: string
The name of the policy document.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- UserName
-
- Required: Yes
- Type: string
The name of the user to associate the policy with.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To attach a policy to an IAM user
The following command attaches a policy to the IAM user named Bob.
$result = $client->putUserPolicy([ 'PolicyDocument' => '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"*","Resource":"*"}}', 'PolicyName' => 'AllAccessPolicy', 'UserName' => 'Bob', ]);
RemoveClientIDFromOpenIDConnectProvider
$result = $client->removeClientIDFromOpenIDConnectProvider
([/* ... */]); $promise = $client->removeClientIDFromOpenIDConnectProviderAsync
([/* ... */]);
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 operation is idempotent; it does not fail or return an error if you try to remove a client ID that does not exist.
Parameter Syntax
$result = $client->removeClientIDFromOpenIDConnectProvider([ 'ClientID' => '<string>', // REQUIRED 'OpenIDConnectProviderArn' => '<string>', // REQUIRED ]);
Parameter Details
Members
- ClientID
-
- Required: Yes
- Type: string
The client ID (also known as audience) to remove from the IAM OIDC provider resource. For more information about client IDs, see CreateOpenIDConnectProvider.
- OpenIDConnectProviderArn
-
- Required: Yes
- Type: 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 operation.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
Result Syntax
[]
Result Details
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
RemoveRoleFromInstanceProfile
$result = $client->removeRoleFromInstanceProfile
([/* ... */]); $promise = $client->removeRoleFromInstanceProfileAsync
([/* ... */]);
Removes the specified IAM role from the specified Amazon EC2 instance profile.
Make sure that you do not have any Amazon EC2 instances running with the role you are about to remove from the instance profile. Removing a role from an instance profile that is associated with a running instance might break any applications running on the instance.
For more information about roles, see IAM roles in the IAM User Guide. For more information about instance profiles, see Using instance profiles in the IAM User Guide.
Parameter Syntax
$result = $client->removeRoleFromInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED 'RoleName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the instance profile to update.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- RoleName
-
- Required: Yes
- Type: string
The name of the role to remove.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- UnmodifiableEntityException:
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To remove a role from an instance profile
The following command removes the role named Test-Role from the instance profile named ExampleInstanceProfile.
$result = $client->removeRoleFromInstanceProfile([ 'InstanceProfileName' => 'ExampleInstanceProfile', 'RoleName' => 'Test-Role', ]);
RemoveUserFromGroup
$result = $client->removeUserFromGroup
([/* ... */]); $promise = $client->removeUserFromGroupAsync
([/* ... */]);
Removes the specified user from the specified group.
Parameter Syntax
$result = $client->removeUserFromGroup([ 'GroupName' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- GroupName
-
- Required: Yes
- Type: string
The name of the group to update.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- UserName
-
- Required: Yes
- Type: string
The name of the user to remove.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To remove a user from an IAM group
The following command removes the user named Bob from the IAM group named Admins.
$result = $client->removeUserFromGroup([ 'GroupName' => 'Admins', 'UserName' => 'Bob', ]);
ResetServiceSpecificCredential
$result = $client->resetServiceSpecificCredential
([/* ... */]); $promise = $client->resetServiceSpecificCredentialAsync
([/* ... */]);
Resets the password for a service-specific credential. The new password is Amazon Web Services generated and cryptographically strong. It cannot be configured by the user. Resetting the password immediately invalidates the previous password associated with this user.
Parameter Syntax
$result = $client->resetServiceSpecificCredential([ 'ServiceSpecificCredentialId' => '<string>', // REQUIRED 'UserName' => '<string>', ]);
Parameter Details
Members
- ServiceSpecificCredentialId
-
- Required: Yes
- Type: string
The unique identifier of the service-specific credential.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
- UserName
-
- Type: 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 (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[ 'ServiceSpecificCredential' => [ 'CreateDate' => <DateTime>, 'ServiceName' => '<string>', 'ServicePassword' => '<string>', 'ServiceSpecificCredentialId' => '<string>', 'ServiceUserName' => '<string>', 'Status' => 'Active|Inactive', 'UserName' => '<string>', ], ]
Result Details
Members
- ServiceSpecificCredential
-
- Type: ServiceSpecificCredential structure
A structure with details about the updated service-specific credential, including the new password.
This is the only time that you can access the password. You cannot recover the password later, but you can reset it again.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
ResyncMFADevice
$result = $client->resyncMFADevice
([/* ... */]); $promise = $client->resyncMFADeviceAsync
([/* ... */]);
Synchronizes the specified MFA device with its IAM resource object on the Amazon Web Services servers.
For more information about creating and working with virtual MFA devices, see Using a virtual MFA device in the IAM User Guide.
Parameter Syntax
$result = $client->resyncMFADevice([ 'AuthenticationCode1' => '<string>', // REQUIRED 'AuthenticationCode2' => '<string>', // REQUIRED 'SerialNumber' => '<string>', // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AuthenticationCode1
-
- Required: Yes
- Type: string
An authentication code emitted by the device.
The format for this parameter is a sequence of six digits.
- AuthenticationCode2
-
- Required: Yes
- Type: string
A subsequent authentication code emitted by the device.
The format for this parameter is a sequence of six digits.
- SerialNumber
-
- Required: Yes
- Type: string
Serial number that uniquely identifies the MFA device.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- UserName
-
- Required: Yes
- Type: string
The name of the user whose MFA device you want to resynchronize.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- InvalidAuthenticationCodeException:
The request was rejected because the authentication code was not recognized. The error message describes the specific error.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
SetDefaultPolicyVersion
$result = $client->setDefaultPolicyVersion
([/* ... */]); $promise = $client->setDefaultPolicyVersionAsync
([/* ... */]);
Sets the specified version of the specified policy as the policy's default (operative) version.
This operation 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 ListEntitiesForPolicy.
For information about managed policies, see Managed policies and inline policies in the IAM User Guide.
Parameter Syntax
$result = $client->setDefaultPolicyVersion([ 'PolicyArn' => '<string>', // REQUIRED 'VersionId' => '<string>', // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: 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) in the Amazon Web Services General Reference.
- VersionId
-
- Required: Yes
- Type: 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.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
SetSecurityTokenServicePreferences
$result = $client->setSecurityTokenServicePreferences
([/* ... */]); $promise = $client->setSecurityTokenServicePreferencesAsync
([/* ... */]);
Sets the specified version of the global endpoint token as the token version used for the Amazon Web Services account.
By default, Security Token Service (STS) is available as a global service, and all STS requests go to a single endpoint at https://sts.amazonaws.com
. Amazon Web Services recommends using Regional STS endpoints to reduce latency, build in redundancy, and increase session token availability. For information about Regional endpoints for STS, see Security Token Service endpoints and quotas in the Amazon Web Services General Reference.
If you make an STS call to the global endpoint, the resulting session tokens might be valid in some Regions but not others. It depends on the version that is set in this operation. Version 1 tokens are valid only in Amazon Web Services Regions that are available by default. These tokens do not work in manually enabled Regions, such as Asia Pacific (Hong Kong). Version 2 tokens are valid in all Regions. However, version 2 tokens are longer and might affect systems where you temporarily store tokens. For information, see Activating and deactivating STS in an Amazon Web Services Region in the IAM User Guide.
To view the current session token version, see the GlobalEndpointTokenVersion
entry in the response of the GetAccountSummary operation.
Parameter Syntax
$result = $client->setSecurityTokenServicePreferences([ 'GlobalEndpointTokenVersion' => 'v1Token|v2Token', // REQUIRED ]);
Parameter Details
Members
- GlobalEndpointTokenVersion
-
- Required: Yes
- Type: string
The version of the global endpoint token. Version 1 tokens are valid only in Amazon Web Services Regions that are available by default. These tokens do not work in manually enabled Regions, such as Asia Pacific (Hong Kong). Version 2 tokens are valid in all Regions. However, version 2 tokens are longer and might affect systems where you temporarily store tokens.
For information, see Activating and deactivating STS in an Amazon Web Services Region in the IAM User Guide.
Result Syntax
[]
Result Details
Errors
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To delete an access key for an IAM user
The following command sets the STS global endpoint token to version 2. Version 2 tokens are valid in all Regions.
$result = $client->setSecurityTokenServicePreferences([ 'GlobalEndpointTokenVersion' => 'v2Token', ]);
SimulateCustomPolicy
$result = $client->simulateCustomPolicy
([/* ... */]); $promise = $client->simulateCustomPolicyAsync
([/* ... */]);
Simulate how a set of IAM policies and optionally a resource-based policy works with a list of API operations and Amazon Web Services resources to determine the policies' effective permissions. The policies are provided as strings.
The simulation does not perform the API operations; it only checks the authorization to determine if the simulated policies allow or deny the operations. You can simulate resources that don't exist in your account.
If you want to simulate existing policies that are attached to an IAM user, group, or role, use SimulatePrincipalPolicy instead.
Context keys are variables that are maintained by Amazon Web Services and its services and which 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.
The IAM policy simulator evaluates statements in the identity-based policy and the inputs that you provide during simulation. The policy simulator results can differ from your live Amazon Web Services environment. We recommend that you check your policies against your live Amazon Web Services environment after testing using the policy simulator to confirm that you have the desired results. For more information about using the policy simulator, see Testing IAM policies with the IAM policy simulator in the IAM User Guide.
Parameter Syntax
$result = $client->simulateCustomPolicy([ 'ActionNames' => ['<string>', ...], // REQUIRED 'CallerArn' => '<string>', 'ContextEntries' => [ [ 'ContextKeyName' => '<string>', 'ContextKeyType' => 'string|stringList|numeric|numericList|boolean|booleanList|ip|ipList|binary|binaryList|date|dateList', 'ContextKeyValues' => ['<string>', ...], ], // ... ], 'Marker' => '<string>', 'MaxItems' => <integer>, 'PermissionsBoundaryPolicyInputList' => ['<string>', ...], 'PolicyInputList' => ['<string>', ...], // REQUIRED 'ResourceArns' => ['<string>', ...], 'ResourceHandlingOption' => '<string>', 'ResourceOwner' => '<string>', 'ResourcePolicy' => '<string>', ]);
Parameter Details
Members
- ActionNames
-
- Required: Yes
- Type: Array of strings
A list of names of API operations to evaluate in the simulation. Each operation is evaluated against each resource. Each operation must include the service identifier, such as
iam:CreateUser
. This operation does not support using wildcards (*) in an action name. - CallerArn
-
- Type: string
The ARN of the IAM user that you want to use as the simulated caller of the API operations.
CallerArn
is required if you include aResourcePolicy
so that the policy'sPrincipal
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.
- ContextEntries
-
- Type: Array of ContextEntry structures
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 permissions policies, the corresponding value is supplied.
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PermissionsBoundaryPolicyInputList
-
- Type: Array of strings
The IAM permissions boundary policy to simulate. The permissions boundary sets the maximum permissions that an IAM entity can have. You can input only one permissions boundary when you pass a policy to this operation. For more information about permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide. The policy input is specified as a string that contains the complete, valid JSON text of a permissions boundary policy.
The maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicyInputList
-
- Required: Yes
- Type: Array of strings
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 API operations. In other words, do not use policies designed to restrict what a user can do while using the temporary credentials.The maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- ResourceArns
-
- Type: Array of strings
A list of ARNs of Amazon Web Services resources to include in the simulation. If this parameter is not provided, then the value defaults to
*
(all resources). Each API in theActionNames
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. You can simulate resources that don't exist in your account.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) in the Amazon Web Services General Reference.
Simulation of resource-based policies isn't supported for IAM roles.
- ResourceHandlingOption
-
- Type: string
Specifies the type of simulation to run. Different API operations 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 Amazon 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 Amazon 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 Amazon EC2 scenario options, see Supported platforms in the Amazon EC2 User Guide.
-
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
- ResourceOwner
-
- Type: string
An ARN representing the Amazon Web Services account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN. Examples of resource ARNs include an S3 bucket or object. If
ResourceOwner
is specified, it is also used as the account owner of anyResourcePolicy
included in the simulation. If theResourceOwner
parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided inCallerArn
. 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 userCallerArn
.The ARN for an account uses the following syntax:
arn:aws:iam::AWS-account-ID:root
. For example, to represent the account with the 112233445566 ID, use the following ARN:arn:aws:iam::112233445566-ID:root
. - ResourcePolicy
-
- Type: 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 maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
Simulation of resource-based policies isn't supported for IAM roles.
Result Syntax
[ 'EvaluationResults' => [ [ 'EvalActionName' => '<string>', 'EvalDecision' => 'allowed|explicitDeny|implicitDeny', 'EvalDecisionDetails' => ['<string>', ...], 'EvalResourceName' => '<string>', 'MatchedStatements' => [ [ 'EndPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], 'SourcePolicyId' => '<string>', 'SourcePolicyType' => 'user|group|role|aws-managed|user-managed|resource|none', 'StartPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], ], // ... ], 'MissingContextValues' => ['<string>', ...], 'OrganizationsDecisionDetail' => [ 'AllowedByOrganizations' => true || false, ], 'PermissionsBoundaryDecisionDetail' => [ 'AllowedByPermissionsBoundary' => true || false, ], 'ResourceSpecificResults' => [ [ 'EvalDecisionDetails' => ['<string>', ...], 'EvalResourceDecision' => 'allowed|explicitDeny|implicitDeny', 'EvalResourceName' => '<string>', 'MatchedStatements' => [ [ 'EndPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], 'SourcePolicyId' => '<string>', 'SourcePolicyType' => 'user|group|role|aws-managed|user-managed|resource|none', 'StartPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], ], // ... ], 'MissingContextValues' => ['<string>', ...], 'PermissionsBoundaryDecisionDetail' => [ 'AllowedByPermissionsBoundary' => true || false, ], ], // ... ], ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- EvaluationResults
-
- Type: Array of EvaluationResult structures
The results of the simulation.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- PolicyEvaluationException:
The request failed because a provided policy could not be successfully evaluated. An additional detailed message indicates the source of the failure.
SimulatePrincipalPolicy
$result = $client->simulatePrincipalPolicy
([/* ... */]); $promise = $client->simulatePrincipalPolicyAsync
([/* ... */]);
Simulate how a set of IAM policies attached to an IAM entity works with a list of API operations and Amazon Web Services 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 simulate resources that don't exist in your account.
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 for IAM users only.
The simulation does not perform the API operations; it only checks the authorization to determine if the simulated policies allow or deny the operations.
Note: This operation 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 Amazon Web Services 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.
The IAM policy simulator evaluates statements in the identity-based policy and the inputs that you provide during simulation. The policy simulator results can differ from your live Amazon Web Services environment. We recommend that you check your policies against your live Amazon Web Services environment after testing using the policy simulator to confirm that you have the desired results. For more information about using the policy simulator, see Testing IAM policies with the IAM policy simulator in the IAM User Guide.
Parameter Syntax
$result = $client->simulatePrincipalPolicy([ 'ActionNames' => ['<string>', ...], // REQUIRED 'CallerArn' => '<string>', 'ContextEntries' => [ [ 'ContextKeyName' => '<string>', 'ContextKeyType' => 'string|stringList|numeric|numericList|boolean|booleanList|ip|ipList|binary|binaryList|date|dateList', 'ContextKeyValues' => ['<string>', ...], ], // ... ], 'Marker' => '<string>', 'MaxItems' => <integer>, 'PermissionsBoundaryPolicyInputList' => ['<string>', ...], 'PolicyInputList' => ['<string>', ...], 'PolicySourceArn' => '<string>', // REQUIRED 'ResourceArns' => ['<string>', ...], 'ResourceHandlingOption' => '<string>', 'ResourceOwner' => '<string>', 'ResourcePolicy' => '<string>', ]);
Parameter Details
Members
- ActionNames
-
- Required: Yes
- Type: Array of strings
A list of names of API operations to evaluate in the simulation. Each operation is evaluated for each resource. Each operation must include the service identifier, such as
iam:CreateUser
. - CallerArn
-
- Type: string
The ARN of the IAM user that you want to specify as the simulated caller of the API operations. If you do not specify a
CallerArn
, it defaults to the ARN of the user that you specify inPolicySourceArn
, if you specified a user. If you include both aPolicySourceArn
(for example,arn:aws:iam::123456789012:user/David
) and aCallerArn
(for example,arn:aws:iam::123456789012:user/Bob
), the result is that you simulate calling the API operations 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 aResourcePolicy
and thePolicySourceArn
is not the ARN for an IAM user. This is required so that the resource-based policy'sPrincipal
element has a value to use in evaluating the policy.For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
- ContextEntries
-
- Type: Array of ContextEntry structures
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 permissions policies, the corresponding value is supplied.
- Marker
-
- Type: 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. - MaxItems
-
- Type: int
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 istrue
.If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the
IsTruncated
response element returnstrue
, andMarker
contains a value to include in the subsequent call that tells the service where to continue from. - PermissionsBoundaryPolicyInputList
-
- Type: Array of strings
The IAM permissions boundary policy to simulate. The permissions boundary sets the maximum permissions that the entity can have. You can input only one permissions boundary when you pass a policy to this operation. An IAM entity can only have one permissions boundary in effect at a time. For example, if a permissions boundary is attached to an entity and you pass in a different permissions boundary policy using this parameter, then the new permissions boundary policy is used for the simulation. For more information about permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide. The policy input is specified as a string containing the complete, valid JSON text of a permissions boundary policy.
The maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicyInputList
-
- Type: Array of strings
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 the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
- PolicySourceArn
-
- Required: Yes
- Type: 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.
The maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
- ResourceArns
-
- Type: Array of strings
A list of ARNs of Amazon Web Services resources to include in the simulation. If this parameter is not provided, then the value defaults to
*
(all resources). Each API in theActionNames
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. You can simulate resources that don't exist in your account.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) in the Amazon Web Services General Reference.
Simulation of resource-based policies isn't supported for IAM roles.
- ResourceHandlingOption
-
- Type: string
Specifies the type of simulation to run. Different API operations 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 Amazon 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 Amazon 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 Amazon EC2 scenario options, see Supported platforms in the Amazon EC2 User Guide.
-
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
- ResourceOwner
-
- Type: string
An Amazon Web Services account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN. Examples of resource ARNs include an S3 bucket or object. If
ResourceOwner
is specified, it is also used as the account owner of anyResourcePolicy
included in the simulation. If theResourceOwner
parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided inCallerArn
. 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 userCallerArn
. - ResourcePolicy
-
- Type: 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 maximum length of the policy document that you can pass in this operation, including whitespace, is listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
The regex pattern used to validate this parameter is a string of characters consisting of the following:
-
Any printable ASCII character ranging from the space character (
\u0020
) through the end of the ASCII character range -
The printable characters in the Basic Latin and Latin-1 Supplement character set (through
\u00FF
) -
The special characters tab (
\u0009
), line feed (\u000A
), and carriage return (\u000D
)
Simulation of resource-based policies isn't supported for IAM roles.
Result Syntax
[ 'EvaluationResults' => [ [ 'EvalActionName' => '<string>', 'EvalDecision' => 'allowed|explicitDeny|implicitDeny', 'EvalDecisionDetails' => ['<string>', ...], 'EvalResourceName' => '<string>', 'MatchedStatements' => [ [ 'EndPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], 'SourcePolicyId' => '<string>', 'SourcePolicyType' => 'user|group|role|aws-managed|user-managed|resource|none', 'StartPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], ], // ... ], 'MissingContextValues' => ['<string>', ...], 'OrganizationsDecisionDetail' => [ 'AllowedByOrganizations' => true || false, ], 'PermissionsBoundaryDecisionDetail' => [ 'AllowedByPermissionsBoundary' => true || false, ], 'ResourceSpecificResults' => [ [ 'EvalDecisionDetails' => ['<string>', ...], 'EvalResourceDecision' => 'allowed|explicitDeny|implicitDeny', 'EvalResourceName' => '<string>', 'MatchedStatements' => [ [ 'EndPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], 'SourcePolicyId' => '<string>', 'SourcePolicyType' => 'user|group|role|aws-managed|user-managed|resource|none', 'StartPosition' => [ 'Column' => <integer>, 'Line' => <integer>, ], ], // ... ], 'MissingContextValues' => ['<string>', ...], 'PermissionsBoundaryDecisionDetail' => [ 'AllowedByPermissionsBoundary' => true || false, ], ], // ... ], ], // ... ], 'IsTruncated' => true || false, 'Marker' => '<string>', ]
Result Details
Members
- EvaluationResults
-
- Type: Array of EvaluationResult structures
The results of the simulation.
- IsTruncated
-
- Type: boolean
A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the
Marker
request parameter to retrieve more items. Note that IAM might return fewer than theMaxItems
number of results even when there are more results available. We recommend that you checkIsTruncated
after every call to ensure that you receive all your results. - Marker
-
- Type: string
When
IsTruncated
istrue
, this element is present and contains the value to use for theMarker
parameter in a subsequent pagination request.
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- PolicyEvaluationException:
The request failed because a provided policy could not be successfully evaluated. An additional detailed message indicates the source of the failure.
TagInstanceProfile
$result = $client->tagInstanceProfile
([/* ... */]); $promise = $client->tagInstanceProfileAsync
([/* ... */]);
Adds one or more tags to an IAM instance profile. If a tag with the same key name already exists, then that tag is overwritten with the new value.
Each tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM user-based and resource-based policies. You can use tags to restrict access to only an IAM instance profile that has a specified tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
Parameter Syntax
$result = $client->tagInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the IAM instance profile to which you want to add tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the IAM instance profile. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
TagMFADevice
$result = $client->tagMFADevice
([/* ... */]); $promise = $client->tagMFADeviceAsync
([/* ... */]);
Adds one or more tags to an IAM virtual multi-factor authentication (MFA) device. If a tag with the same key name already exists, then that tag is overwritten with the new value.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM user-based and resource-based policies. You can use tags to restrict access to only an IAM virtual MFA device that has a specified tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
Parameter Syntax
$result = $client->tagMFADevice([ 'SerialNumber' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- SerialNumber
-
- Required: Yes
- Type: string
The unique identifier for the IAM virtual MFA device to which you want to add tags. For virtual MFA devices, the serial number is the same as the ARN.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the IAM virtual MFA device. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
TagOpenIDConnectProvider
$result = $client->tagOpenIDConnectProvider
([/* ... */]); $promise = $client->tagOpenIDConnectProviderAsync
([/* ... */]);
Adds one or more tags to an OpenID Connect (OIDC)-compatible identity provider. For more information about these providers, see About web identity federation. If a tag with the same key name already exists, then that tag is overwritten with the new value.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM identity-based and resource-based policies. You can use tags to restrict access to only an OIDC provider that has a specified tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
Parameter Syntax
$result = $client->tagOpenIDConnectProvider([ 'OpenIDConnectProviderArn' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- OpenIDConnectProviderArn
-
- Required: Yes
- Type: string
The ARN of the OIDC identity provider in IAM to which you want to add tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the OIDC identity provider in IAM. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
TagPolicy
$result = $client->tagPolicy
([/* ... */]); $promise = $client->tagPolicyAsync
([/* ... */]);
Adds one or more tags to an IAM customer managed policy. If a tag with the same key name already exists, then that tag is overwritten with the new value.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM user-based and resource-based policies. You can use tags to restrict access to only an IAM customer managed policy that has a specified tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
Parameter Syntax
$result = $client->tagPolicy([ 'PolicyArn' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The ARN of the IAM customer managed policy to which you want to add tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the IAM customer managed policy. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
TagRole
$result = $client->tagRole
([/* ... */]); $promise = $client->tagRoleAsync
([/* ... */]);
Adds one or more tags to an IAM role. The role can be a regular role or a service-linked role. If a tag with the same key name already exists, then that tag is overwritten with the new value.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM user-based and resource-based policies. You can use tags to restrict access to only an IAM role that has a specified tag attached. You can also restrict access to only those resources that have a certain tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
Cost allocation - Use tags to help track which individuals and teams are using which Amazon Web Services resources.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
For more information about tagging, see Tagging IAM identities in the IAM User Guide.
Parameter Syntax
$result = $client->tagRole([ 'RoleName' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- RoleName
-
- Required: Yes
- Type: string
The name of the IAM role to which you want to add tags.
This parameter accepts (through its regex pattern) a string of characters that consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the IAM role. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To add a tag key and value to an IAM role
The following example shows how to add tags to an existing role.
$result = $client->tagRole([ 'RoleName' => 'taggedrole', 'Tags' => [ [ 'Key' => 'Dept', 'Value' => 'Accounting', ], [ 'Key' => 'CostCenter', 'Value' => '12345', ], ], ]);
TagSAMLProvider
$result = $client->tagSAMLProvider
([/* ... */]); $promise = $client->tagSAMLProviderAsync
([/* ... */]);
Adds one or more tags to a Security Assertion Markup Language (SAML) identity provider. For more information about these providers, see About SAML 2.0-based federation . If a tag with the same key name already exists, then that tag is overwritten with the new value.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM user-based and resource-based policies. You can use tags to restrict access to only a SAML identity provider that has a specified tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
Parameter Syntax
$result = $client->tagSAMLProvider([ 'SAMLProviderArn' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- SAMLProviderArn
-
- Required: Yes
- Type: string
The ARN of the SAML identity provider in IAM to which you want to add tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the SAML identity provider in IAM. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
TagServerCertificate
$result = $client->tagServerCertificate
([/* ... */]); $promise = $client->tagServerCertificateAsync
([/* ... */]);
Adds one or more tags to an IAM server certificate. If a tag with the same key name already exists, then that tag is overwritten with the new value.
For certificates in a Region supported by Certificate Manager (ACM), we recommend that you don't use IAM server certificates. Instead, use ACM to provision, manage, and deploy your server certificates. For more information about IAM server certificates, Working with server certificates in the IAM User Guide.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM user-based and resource-based policies. You can use tags to restrict access to only a server certificate that has a specified tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
Cost allocation - Use tags to help track which individuals and teams are using which Amazon Web Services resources.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
Parameter Syntax
$result = $client->tagServerCertificate([ 'ServerCertificateName' => '<string>', // REQUIRED 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- ServerCertificateName
-
- Required: Yes
- Type: string
The name of the IAM server certificate to which you want to add tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the IAM server certificate. Each tag consists of a key name and an associated value.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
TagUser
$result = $client->tagUser
([/* ... */]); $promise = $client->tagUserAsync
([/* ... */]);
Adds one or more tags to an IAM user. If a tag with the same key name already exists, then that tag is overwritten with the new value.
A tag consists of a key name and an associated value. By assigning tags to your resources, you can do the following:
-
Administrative grouping and discovery - Attach tags to resources to aid in organization and search. For example, you could search for all resources with the key name Project and the value MyImportantProject. Or search for all resources with the key name Cost Center and the value 41200.
-
Access control - Include tags in IAM identity-based and resource-based policies. You can use tags to restrict access to only an IAM requesting user that has a specified tag attached. You can also restrict access to only those resources that have a certain tag attached. For examples of policies that show how to use tags to control access, see Control access using IAM tags in the IAM User Guide.
-
Cost allocation - Use tags to help track which individuals and teams are using which Amazon Web Services resources.
-
If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
-
Amazon Web Services always interprets the tag
Value
as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.
For more information about tagging, see Tagging IAM identities in the IAM User Guide.
Parameter Syntax
$result = $client->tagUser([ 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- Tags
-
- Required: Yes
- Type: Array of Tag structures
The list of tags that you want to attach to the IAM user. Each tag consists of a key name and an associated value.
- UserName
-
- Required: Yes
- Type: string
The name of the IAM user to which you want to add tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To add a tag key and value to an IAM user
The following example shows how to add tags to an existing user.
$result = $client->tagUser([ 'Tags' => [ [ 'Key' => 'Dept', 'Value' => 'Accounting', ], [ 'Key' => 'CostCenter', 'Value' => '12345', ], ], 'UserName' => 'anika', ]);
UntagInstanceProfile
$result = $client->untagInstanceProfile
([/* ... */]); $promise = $client->untagInstanceProfileAsync
([/* ... */]);
Removes the specified tags from the IAM instance profile. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagInstanceProfile([ 'InstanceProfileName' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- InstanceProfileName
-
- Required: Yes
- Type: string
The name of the IAM instance profile from which you want to remove tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified instance profile.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
UntagMFADevice
$result = $client->untagMFADevice
([/* ... */]); $promise = $client->untagMFADeviceAsync
([/* ... */]);
Removes the specified tags from the IAM virtual multi-factor authentication (MFA) device. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagMFADevice([ 'SerialNumber' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- SerialNumber
-
- Required: Yes
- Type: string
The unique identifier for the IAM virtual MFA device from which you want to remove tags. For virtual MFA devices, the serial number is the same as the ARN.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified instance profile.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
UntagOpenIDConnectProvider
$result = $client->untagOpenIDConnectProvider
([/* ... */]); $promise = $client->untagOpenIDConnectProviderAsync
([/* ... */]);
Removes the specified tags from the specified OpenID Connect (OIDC)-compatible identity provider in IAM. For more information about OIDC providers, see About web identity federation. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagOpenIDConnectProvider([ 'OpenIDConnectProviderArn' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- OpenIDConnectProviderArn
-
- Required: Yes
- Type: string
The ARN of the OIDC provider in IAM from which you want to remove tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified OIDC provider.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
UntagPolicy
$result = $client->untagPolicy
([/* ... */]); $promise = $client->untagPolicyAsync
([/* ... */]);
Removes the specified tags from the customer managed policy. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagPolicy([ 'PolicyArn' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- PolicyArn
-
- Required: Yes
- Type: string
The ARN of the IAM customer managed policy from which you want to remove tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified policy.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
UntagRole
$result = $client->untagRole
([/* ... */]); $promise = $client->untagRoleAsync
([/* ... */]);
Removes the specified tags from the role. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagRole([ 'RoleName' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- RoleName
-
- Required: Yes
- Type: string
The name of the IAM role from which you want to remove tags.
This parameter accepts (through its regex pattern) a string of characters that consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified role.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To remove a tag from an IAM role
The following example shows how to remove a tag with the key 'Dept' from a role named 'taggedrole'.
$result = $client->untagRole([ 'RoleName' => 'taggedrole', 'TagKeys' => [ 'Dept', ], ]);
UntagSAMLProvider
$result = $client->untagSAMLProvider
([/* ... */]); $promise = $client->untagSAMLProviderAsync
([/* ... */]);
Removes the specified tags from the specified Security Assertion Markup Language (SAML) identity provider in IAM. For more information about these providers, see About web identity federation. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagSAMLProvider([ 'SAMLProviderArn' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- SAMLProviderArn
-
- Required: Yes
- Type: string
The ARN of the SAML identity provider in IAM from which you want to remove tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified SAML identity provider.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
UntagServerCertificate
$result = $client->untagServerCertificate
([/* ... */]); $promise = $client->untagServerCertificateAsync
([/* ... */]);
Removes the specified tags from the IAM server certificate. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
For certificates in a Region supported by Certificate Manager (ACM), we recommend that you don't use IAM server certificates. Instead, use ACM to provision, manage, and deploy your server certificates. For more information about IAM server certificates, Working with server certificates in the IAM User Guide.
Parameter Syntax
$result = $client->untagServerCertificate([ 'ServerCertificateName' => '<string>', // REQUIRED 'TagKeys' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
- ServerCertificateName
-
- Required: Yes
- Type: string
The name of the IAM server certificate from which you want to remove tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified IAM server certificate.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- InvalidInputException:
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
UntagUser
$result = $client->untagUser
([/* ... */]); $promise = $client->untagUserAsync
([/* ... */]);
Removes the specified tags from the user. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
Parameter Syntax
$result = $client->untagUser([ 'TagKeys' => ['<string>', ...], // REQUIRED 'UserName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- TagKeys
-
- Required: Yes
- Type: Array of strings
A list of key names as a simple array of strings. The tags with matching keys are removed from the specified user.
- UserName
-
- Required: Yes
- Type: string
The name of the IAM user from which you want to remove tags.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- ConcurrentModificationException:
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To remove a tag from an IAM user
The following example shows how to remove tags that are attached to a user named 'anika'.
$result = $client->untagUser([ 'TagKeys' => [ 'Dept', ], 'UserName' => 'anika', ]);
UpdateAccessKey
$result = $client->updateAccessKey
([/* ... */]); $promise = $client->updateAccessKeyAsync
([/* ... */]);
Changes the status of the specified access key from Active to Inactive, or vice versa. This operation can be used to disable a user's key as part of a key rotation workflow.
If the UserName
is not specified, the user name is determined implicitly based on the Amazon Web Services access key ID used to sign the request. If a temporary access key is used, then UserName
is required. If a long-term key is assigned to the user, then UserName
is not required. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials even if the Amazon Web Services account has no associated users.
For information about rotating keys, see Managing keys and certificates in the IAM User Guide.
Parameter Syntax
$result = $client->updateAccessKey([ 'AccessKeyId' => '<string>', // REQUIRED 'Status' => 'Active|Inactive', // REQUIRED 'UserName' => '<string>', ]);
Parameter Details
Members
- AccessKeyId
-
- Required: Yes
- Type: string
The access key ID of the secret access key you want to update.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
- Status
-
- Required: Yes
- Type: string
The status you want to assign to the secret access key.
Active
means that the key can be used for programmatic calls to Amazon Web Services, whileInactive
means that the key cannot be used. - UserName
-
- Type: string
The name of the user whose key you want to update.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To activate or deactivate an access key for an IAM user
The following command deactivates the specified access key (access key ID and secret access key) for the IAM user named Bob.
$result = $client->updateAccessKey([ 'AccessKeyId' => 'AKIAIOSFODNN7EXAMPLE', 'Status' => 'Inactive', 'UserName' => 'Bob', ]);
UpdateAccountPasswordPolicy
$result = $client->updateAccountPasswordPolicy
([/* ... */]); $promise = $client->updateAccountPasswordPolicyAsync
([/* ... */]);
Updates the password policy settings for the Amazon Web Services account.
This operation does not support partial updates. No parameters are required, but if you do not specify a parameter, that parameter's value reverts to its default value. See the Request Parameters section for each parameter's default value. Also note that some parameters do not allow the default parameter to be explicitly set. Instead, to invoke the default value, do not include that parameter when you invoke the operation.
For more information about using a password policy, see Managing an IAM password policy in the IAM User Guide.
Parameter Syntax
$result = $client->updateAccountPasswordPolicy([ 'AllowUsersToChangePassword' => true || false, 'HardExpiry' => true || false, 'MaxPasswordAge' => <integer>, 'MinimumPasswordLength' => <integer>, 'PasswordReusePrevention' => <integer>, 'RequireLowercaseCharacters' => true || false, 'RequireNumbers' => true || false, 'RequireSymbols' => true || false, 'RequireUppercaseCharacters' => true || false, ]);
Parameter Details
Members
- AllowUsersToChangePassword
-
- Type: boolean
Allows all IAM users in your account to use the Amazon Web Services Management Console to change their own passwords. For more information, see Permitting IAM users to change their own passwords in the IAM User Guide.
If you do not specify a value for this parameter, then the operation uses the default value of
false
. The result is that IAM users in the account do not automatically have permissions to change their own password. - HardExpiry
-
- Type: boolean
Prevents IAM users who are accessing the account via the Amazon Web Services Management Console from setting a new console password after their password has expired. The IAM user cannot access the console until an administrator resets the password.
If you do not specify a value for this parameter, then the operation uses the default value of
false
. The result is that IAM users can change their passwords after they expire and continue to sign in as the user.In the Amazon Web Services Management Console, the custom password policy option Allow users to change their own password gives IAM users permissions to
iam:ChangePassword
for only their user and to theiam:GetAccountPasswordPolicy
action. This option does not attach a permissions policy to each user, rather the permissions are applied at the account-level for all users by IAM. IAM users withiam:ChangePassword
permission and active access keys can reset their own expired console password using the CLI or API. - MaxPasswordAge
-
- Type: int
The number of days that an IAM user password is valid.
If you do not specify a value for this parameter, then the operation uses the default value of
0
. The result is that IAM user passwords never expire. - MinimumPasswordLength
-
- Type: int
The minimum number of characters allowed in an IAM user password.
If you do not specify a value for this parameter, then the operation uses the default value of
6
. - PasswordReusePrevention
-
- Type: int
Specifies the number of previous passwords that IAM users are prevented from reusing.
If you do not specify a value for this parameter, then the operation uses the default value of
0
. The result is that IAM users are not prevented from reusing previous passwords. - RequireLowercaseCharacters
-
- Type: boolean
Specifies whether IAM user passwords must contain at least one lowercase character from the ISO basic Latin alphabet (a to z).
If you do not specify a value for this parameter, then the operation uses the default value of
false
. The result is that passwords do not require at least one lowercase character. - RequireNumbers
-
- Type: boolean
Specifies whether IAM user passwords must contain at least one numeric character (0 to 9).
If you do not specify a value for this parameter, then the operation uses the default value of
false
. The result is that passwords do not require at least one numeric character. - RequireSymbols
-
- Type: boolean
Specifies whether IAM user passwords must contain at least one of the following non-alphanumeric characters:
! @ # $ % ^ & * ( ) _ + - = [ ] { } | '
If you do not specify a value for this parameter, then the operation uses the default value of
false
. The result is that passwords do not require at least one symbol character. - RequireUppercaseCharacters
-
- Type: boolean
Specifies whether IAM user passwords must contain at least one uppercase character from the ISO basic Latin alphabet (A to Z).
If you do not specify a value for this parameter, then the operation uses the default value of
false
. The result is that passwords do not require at least one uppercase character.
Result Syntax
[]
Result Details
Errors
- NoSuchEntityException:
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
- MalformedPolicyDocumentException:
The request was rejected because the policy document was malformed. The error message describes the specific error.
- LimitExceededException:
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
- ServiceFailureException:
The request processing has failed because of an unknown error, exception or failure.
Examples
Example 1: To set or change the current account password policy
The following command sets the password policy to require a minimum length of eight characters and to require one or more numbers in the password:
$result = $client->updateAccountPasswordPolicy([ 'MinimumPasswordLength' => 8, 'RequireNumbers' => 1, ]);
UpdateAssumeRolePolicy
$result = $client->updateAssumeRolePolicy
([/* ... */]); $promise = $client->updateAs