AWS Security Token Service (AWS STS)
Cloud service · AWS · Updated

AWS Security Token Service (AWS STS)

In short

AWS Security Token Service (AWS STS) is a web service that enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users).

Cloud Services Hub →

Free AWS Security Token Service (AWS STS) tools

6 key features of AWS Security Token Service (AWS STS)

AWS Security Token Service (AWS STS) features include the creation of temporary credentials, permission control through fine-grained access, integration with external identity providers for federated access, facilitation of cross-account access, support for multi-factor authentication, and operation as a globally available service.

01
Temporary Credentials

AWS Security Token Service allows the creation of temporary, short-term credentials that can be used to access AWS resources. These temporary credentials are a more secure alternative to using long-term access keys.

02
Permission Control

With AWS STS, you can define specific permissions for the temporary credentials, ensuring that applications and users have only the access they need, thus following the principle of least privilege.

03
Active Directory Integration

AWS STS supports federated identities, allowing users to authenticate with external identity providers (like Active Directory or LinkedIn) and then assume an IAM role with permissions for accessing AWS resources.

04
Cross-Account Access

It facilitates cross-account access, enabling the creation of trust relationships between AWS accounts or between an AWS account and an external identity provider. This simplifies managing permissions across AWS accounts.

05
Multi-Factor Authentication Support

AWS STS supports multi-factor authentication (MFA), adding an extra layer of security by requiring users to provide additional verification before being granted the temporary credentials.

06
Global Service

Session tokens from Regional AWS STS endpoints are valid in all Regions. Tokens from the global endpoint are valid only in Regions enabled by default unless that endpoint is configured to issue tokens valid in all Regions.

Where AWS Security Token Service (AWS STS) is used

AWS Security Token Service (AWS STS) use cases include providing temporary access to AWS resources, enabling secure cross-account access, facilitating federation with external identity systems, and enhancing security with support for Multi-factor Authentication (MFA).

  1. 01
    Temporary Access for Users

    AWS STS allows the creation of temporary security credentials for users who need to access AWS resources for a short-term project or task. This eliminates the need to manage long-term credentials for every user, enhancing security by automatically expiring credentials.

  2. 02
    Cross-account Access

    It enables secure delegation of access to resources across different AWS accounts without having to share long-term access keys. By using AWS STS, administrators can grant users from one AWS account permissions to access resources in another account in a secure and controlled manner.

  3. 03
    Federation with Identity Systems

    AWS STS facilitates federation with external identity systems such as Active Directory, SAML 2.0-compliant identity providers, or other OpenID Connect (OIDC) compliant providers, enabling users to sign in using their existing corporate credentials to access AWS resources.

  4. 04
    Multi-factor Authentication (MFA) for Enhanced Security

    AWS STS supports the use of Multi-factor Authentication (MFA), adding an additional layer of security. When temporary security credentials are requested, requiring MFA can significantly reduce the risk of unauthorized access.

How AWS Security Token Service (AWS STS) is priced

AWS STS is free for use, with no direct charges for the service itself, but costs may be incurred for requests over 100,000 per month outside of free tier regions and for using the temporary credentials with other AWS services.

AWS Security Token Service (AWS STS) Pricing

AWS Security Token Service (AWS STS) is essentially a free-to-use feature for AWS account holders. However, while there is no direct charge for using AWS STS, any requests made to AWS services using the temporary security credentials generated by AWS STS will incur standard AWS service fees according to the particular service’s pricing model.

Services AWS Security Token Service (AWS STS) works with

Amazon S3Amazon S3

Uses temporary security credentials from AWS STS to grant access to S3 buckets and objects securely.

Amazon EC2Amazon EC2

Allows EC2 instances to assume roles and gain temporary credentials to perform various tasks.

Amazon RDSAmazon RDS

Enables RDS instances or users to get temporary credentials for accessing databases securely.

Amazon DynamoDBAmazon DynamoDB

Grants temporary security credentials to interact with DynamoDB tables while adhering to the principle of least privilege.

AWS LambdaAWS Lambda

Lambda functions can assume roles and get temporary security credentials to access other AWS services.

AWS GlueAWS Glue

Provides temporary security credentials to access data stored in S3, DynamoDB, and other resources for ETL jobs.

What is AWS Security Token Service (AWS STS)

3 min read

AWS Security Token Service (AWS STS) is a web service that enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users). Its primary function is to enhance the security posture of your AWS environment by enforcing the principle of least privilege, ensuring that entities within your environment have only the permissions they absolutely need to accomplish their tasks, and only for a limited period. This mitigates the risks associated with long-standing credentials which, if compromised, could lead to unauthorized access to your resources. 

AWS STS plays a crucial role in the management of temporary credentials. It allows the creation of unique, temporary credentials that can be assigned to users or systems, automatically expiring after a definable period. This effectively reduces the risk of credential leakage or misuse since these credentials, even if compromised, are only valid for a short duration. Additionally, AWS STS provides the ability to grant cross-account access without the need to share long-term credentials, but the assumed role must have a trust policy authorizing the caller. This facilitates secure collaboration between different business units or companies while maintaining tight control over resource access. 

For cross-account AssumeRole requests, only the calling account's STS quota is consumed; the target account's quota is not consumed.

One of the distinguished features of AWS STS is its integration with other AWS services and identity providers. It facilitates the federation of user identities by enabling users to sign in with their credentials from external identity providers like corporate directories, thus avoiding the need to create separate IAM users in AWS. This capability not only streamlines user access management but also leverages the security mechanisms of the external identity providers, such as multi-factor authentication. 

AWS STS supports several use cases, including granting access to AWS resources from applications running on EC2 instances, managing permissions for applications on mobile devices or IoT devices, and providing access to AWS resources for users from external systems. By granting temporary access, AWS STS ensures that the principle of least privilege can be applied more effectively and securely across these diversified environments. 

In operational terms, AWS STS is easy to implement through the AWS Management Console, the AWS Command Line Interface (CLI), or the AWS SDKs. It allows the generation of credentials dynamically, thereby enabling automation and integration into various application flows. The service itself is designed to be highly available and resilient, ensuring that the mechanism for generating and distributing temporary credentials does not become a bottleneck or single point of failure in your architecture. 

AWS recommends using Regional STS endpoints rather than the global (legacy) endpoint to reduce latency and build in redundancy.

For requests made using AWS credentials, the default STS request quota is 600 requests per second per account per Region, shared by AssumeRole, DecodeAuthorizationMessage, GetAccessKeyInfo, GetCallerIdentity, GetFederationToken, and GetSessionToken.

STS requests made by AWS service principals do not consume your accounts' STS requests-per-second quota.

In conclusion, AWS Security Token Service is a critical component of AWS's security and identity services, offering a robust mechanism for managing temporary credentials and enabling secure, efficient access management across AWS environments. Its capabilities support the core security principles of least privilege and defense in depth, making it an indispensable tool for architects and developers looking to design secure cloud-based solutions.

AWS Security Token Service (AWS STS) exam questions

Real practice exam questions on AWS Security Token Service (AWS STS), with the correct answer and its explanation. Answer them with every option in the exam simulator.

CLF-C02

A company runs an on-premises reporting application that obtains temporary AWS credentials through an approved federation process. The application saves the credentials at startup and uses them to read AWS resources. Reports run successfully at first, but later fail because the credentials have expired. The company prohibits storing long-term AWS access keys. Which change will allow the application to continue operating securely?

Show answerCORRECT ANSWER

Update the application to obtain fresh credentials from AWS STS through the approved federation process before the current credentials expire.

AWS STS issues temporary credentials with an expiration time. The application must obtain and use a fresh set of credentials to continue making authenticated requests after the previous set expires.

DVA-C03

A developer signs in to the AWS Management Console through the company's SAML identity provider as the Engineering role, then uses Switch Role to enter the Diagnostics role. During an incident, the developer needs to run AWS CLI commands under two roles in other accounts: ReleaseRead and PartnerCase. Both target roles trust only Diagnostics, and Diagnostics has permission to assume both. PartnerCase also requires an external ID; ReleaseRead does not. The developer has a CLI profile with valid temporary credentials for Diagnostics. Which runbook instructions will let the developer obtain both target role sessions without changing any IAM policies?

Show answerCORRECT ANSWER

Use the Diagnostics CLI profile to call AWS STS AssumeRole for both target roles. Include the external ID only in the request for PartnerCase.

The CLI requests are signed with Diagnostics credentials, so they use the principal trusted by both target roles. The AssumeRole API also accepts the ExternalId parameter required by PartnerCase. The console would instead evaluate a new switch using the original Engineering sign-in.

SAP-C03

A company runs processing workers in its data center and in another cloud provider. The workers use IAM Roles Anywhere to obtain credentials for a bootstrap role, and then explicitly call https://sts.amazonaws.com to assume a data-access role. The workers automatically refresh both credential sets.

The company is expanding into an opt-in AWS Region that is already enabled in the account. Credentials returned by the global endpoint work for Amazon S3 requests in a default-enabled Region but fail with an invalid-token error in the opt-in Region. The account is configured for version 1 session tokens from the global endpoint. The data-access role has the required permissions in both Regions.

The company requires each data-access credential set to work in both Regions until expiration. Credential acquisition must not depend on the global AWS STS endpoint, and the company must not change the account-wide global-endpoint token setting. The bootstrap credential mechanism must remain unchanged.

Which solution meets these requirements?

Show answerCORRECT ANSWER

Replace the explicitly configured global STS endpoint with an enabled Regional STS endpoint for AssumeRole calls. Continue automatically refreshing the returned credentials and use the same credential set for S3 requests in both Regions.

Temporary credentials issued by Regional STS endpoints are valid in all AWS Regions, including enabled opt-in Regions. Calling a Regional endpoint also removes the global STS endpoint from the data-access credential acquisition path without changing the account-wide global-endpoint token setting or the bootstrap mechanism.

Practice AWS Security Token Service (AWS STS) in a full exam

Questions on AWS Security Token Service (AWS STS) in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

Learn AWS Security Token Service (AWS STS) in lessons

19 short lessons on AWS Security Token Service (AWS STS) in 9 certification courses.

and 13 more lessons

Open the lessons

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.