Code examples for IAM using Amazon SDKs
The following code examples show how to use IAM with an Amazon software development kit (SDK).
Actions are code excerpts that show you how to call individual service functions.
Scenarios are code examples that show you how to accomplish a specific task by calling multiple functions within the same service.
Cross-service examples are sample applications that work across multiple Amazon Web Services.
For a complete list of Amazon SDK developer guides and code examples, see Using IAM with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.
Get started
The following code examples show how to get started using Amazon Identity and Access Management (IAM).
Code examples
- Actions
- Add a user to a group
- Attach a policy to a role
- Attach a policy to a user
- Attach an inline policy to a role
- Create a group
- Create a policy
- Create a policy version
- Create a role
- Create a service-linked role
- Create a user
- Create an access key
- Create an alias for an account
- Create an inline policy for a group
- Create an inline policy for a user
- Delete a group
- Delete a group policy
- Delete a policy
- Delete a role
- Delete a role policy
- Delete a server certificate
- Delete a service-linked role
- Delete a user
- Delete an access key
- Delete an account alias
- Delete an inline policy from a user
- Detach a policy from a role
- Detach a policy from a user
- Generate a credential report
- Get a credential report
- Get a detailed authorization report for your account
- Get a policy
- Get a policy version
- Get a role
- Get a server certificate
- Get a summary of account usage
- Get a user
- Get data about the last use of an access key
- Get the account password policy
- List SAML providers
- List a user's access keys
- List account aliases
- List groups
- List inline policies for a role
- List inline policies for a user
- List policies
- List policies attached to a role
- List roles
- List server certificates
- List users
- Remove a user from a group
- Update a server certificate
- Update a user
- Update an access key
- Scenarios
- Cross-service examples