In this lesson, we explore AWS’s Security Token Service (STS), a web service that enables you to request temporary, limited-privilege credentials for users. STS essentially allows you to assume a role and receive temporary credentials that grant access to AWS resources without sharing long-term credentials.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Key STS API Operations
Below are the primary STS API calls that you need to know:-
Assume Role
This API call lets you assume a role. It returns temporary credentials that inherit the permissions of the specified role. -
Assume Role with SAML
Use this API call to obtain temporary credentials for users who are authenticated via SAML. -
Assume Role with Web Identity
Similar to the SAML method, this call returns temporary credentials for users authenticated through a web identity provider (e.g., Google, Facebook, or another OIDC provider). -
Decode Authorization Message
This API decodes additional information from an error message when an AWS request fails, offering more insights into the error. -
Get Caller Identity
This call returns details about the IAM user or role that issued the API call. -
Get Session Token
This API retrieves credentials for users who have multi-factor authentication (MFA) enabled.
Using the Assume Role API
To obtain temporary credentials using a specific role, follow these steps:- Locate the desired role in AWS and note its Amazon Resource Name (ARN).
- Use the AWS Command Line Interface (CLI) to assume the role.
The parameter
--role-session-name is a descriptive name provided to help identify the session. This output includes the Access Key ID, Secret Access Key, Session Token, and the expiration time for these temporary credentials.