Study guide

8.3 AWS Security Token Service (STS) & Temporary Credential Workflows

AWS Certified Security – Specialty SCS-C03

Track your progress as you read

Finished sections get a check mark.

1 Chapter 0: Getting Started with the SCS-C03 Exam

0.1 SCS-C03 Exam Format, Domains & Study Strategy

2 Chapter 1: Security Monitoring, Alerting & Threat Detection Services

1.1 Workload Monitoring & Health Check Strategies 1.2 Amazon GuardDuty Architecture & Finding Types 1.3 AWS Security Hub & Automated Conformance Assessment 1.4 Amazon Macie & Automated Data Classification

3 Chapter 2: Enterprise Logging Architecture & Analysis

2.1 Multi-Account CloudTrail & Organization Trails 2.2 Amazon Security Lake & OCSF Log Normalization 2.3 Network Telemetry: VPC Flow Logs & Route 53 Resolver Logs 2.4 Troubleshooting Security Telemetry & Log Ingestion 2.5 Analyzing, Normalizing & Correlating Security Logs

4 Chapter 3: Incident Readiness, Response Planning & Automated Runbooks

3.1 Incident Response Planning & Blast Radius Mitigation 3.2 Testing & Validating Incident Response Plans 3.3 Automated Incident Remediation with EventBridge & Step Functions 3.4 Systems Manager OpsCenter & Incident Manager Runbooks

5 Chapter 4: Digital Forensics, Evidence Preservation & Root Cause Analysis

4.1 Forensic Artifact Capture & Chain of Custody 4.2 Threat Containment & Network Quarantine Techniques 4.3 Correlating Events & Root Cause Analysis with Amazon Detective

6 Chapter 5: Edge Protection, WAF & DDoS Mitigation

5.1 CloudFront Security Headers & Origin Access Control 5.2 AWS WAF Architecture & Advanced Rule Sets 5.3 AWS Shield Advanced & DDoS Defense Architectures 5.4 Edge Integrations: Managed Rule Groups, OCSF Ingestion, IoT Policies & CORS

7 Chapter 6: Compute Workload Hardening, Vulnerability Management & GenAI Security

6.1 Golden AMIs & Container Image Hardening Pipelines 6.2 Amazon Inspector Vulnerability Management & Patch Automation 6.3 Generative AI Security: Amazon Bedrock Guardrails & Model Protection 6.4 Instance Profiles, Service Roles & Execution Roles for Compute 6.5 Secure Administrative Access: Session Manager & EC2 Instance Connect

8 Chapter 7: Network Security, Segmentation, Private Connectivity & Encryption in Transit

7.1 Layered Traffic Filtering: SGs, NACLs & AWS Network Firewall 7.2 Hybrid Connectivity Security: VPN, Direct Connect & MACsec 7.3 Zero-Trust Access & Network Access Analysis 7.4 Enforcing Encryption in Transit: ELB Security Policies, TLS & HTTPS-Only Access 7.5 Private Access: VPC Endpoints, PrivateLink, Client VPN & Verified Access 7.6 Inter-Resource Encryption in Transit: Nitro, EMR, EKS & SageMaker AI

9 Chapter 8: Enterprise Authentication, Federation & Directory Services

8.1 AWS IAM Identity Center & Enterprise IdP Integration 8.2 Amazon Cognito User Pools & Identity Pools 8.3 AWS Security Token Service (STS) & Temporary Credential Workflows 8.4 Troubleshooting Identity & Authentication Failures

10 Chapter 9: Advanced Authorization Architecture & Policy Evaluation

9.1 Complete AWS Policy Evaluation Logic & Decision Flow 9.2 Permission Boundaries & Safe Admin Delegation 9.3 Attribute-Based Access Control (ABAC) with IAM Tags

11 Chapter 10: Least Privilege, Policy Validation & External Access Auditing

10.1 IAM Roles Anywhere & Amazon Verified Permissions 10.2 Auditing External & Unused Access with IAM Access Analyzer 10.3 Analyzing Authorization Failures & Policy Simulation

12 Chapter 11: Cryptographic Services: KMS Architecture & Key Governance

11.1 AWS KMS Architecture, Key Policies & Key Types 11.2 KMS Grants, Encryption Context & Multi-Region Keys 11.3 Imported Key Material (BYOK) & CloudHSM Key Stores

13 Chapter 12: Secrets Management, Sensitive Data Masking & PKI

12.1 AWS Secrets Manager & Systems Manager Parameter Store 12.2 Sensitive Data Masking in Telemetry & Messaging 12.3 AWS Certificate Manager (ACM) & Private CA Architecture

14 Chapter 13: Storage Encryption, Integrity, Lifecycle & Backup Protection

13.1 S3 Encryption Modes & S3 Bucket Keys 13.2 Data Integrity Protection: Object Lock, Vault Lock & Code Signing 13.3 Secure Data Lifecycle, Cross-Account Replication & Backup Vault Lock 13.4 Lifecycle, Backup & Secure Replication Beyond S3: EFS, FSx, DLM, DataSync & Air-Gapped Vaults

15 Chapter 14: Multi-Account Architecture, Organizations & Control Tower Governance

14.1 AWS Organizations Structure, Hierarchy & Resource Control 14.2 AWS Control Tower Landing Zone & Guardrail Framework 14.3 Delegated Administrator Architecture & Root User Governance 14.4 Centralized Resource Sharing with RAM & Service Catalog

16 Chapter 15: Compliance Automation, Infrastructure as Code Security & Auditing

15.1 Infrastructure as Code Security & Multi-Account Deployment 15.2 AWS Config, Conformance Packs & Automated Remediation 15.3 Audit Evidence Collection & Well-Architected Security Reviews

8.3 AWS Security Token Service (STS) & Temporary Credential Workflows

Key Takeaways Explain This Topic AI

AWS Security Token Service (STS) vends short-lived security credentials consisting of an AccessKeyId (starting with ASIA), SecretAccessKey, SessionToken, and Expiration timestamp, eliminating the risks of persistent static keys.

Core STS API calls serve specific architectural patterns: AssumeRole for IAM cross-account and workload delegation, AssumeRoleWithWebIdentity for OIDC/Kubernetes IRSA federation, AssumeRoleWithSAML for enterprise SSO, and GetSessionToken for MFA-protected user sessions.

Session policies passed during role assumption dynamically restrict session permissions via a mathematical intersection with the role identity-based policies, guaranteeing that permissions can only be narrowed, never expanded.

Assumed role session durations range from 15 minutes to 12 hours, but role chaining (assuming a role from another assumed role) strictly limits the downstream session duration to a maximum of 1 hour.

Amazon S3 presigned URLs generated using STS temporary credentials inherit the expiration of the underlying session token, preventing URLs from exceeding the remaining lifetime of the STS session.

Last updated: September 2026

8.3 AWS Security Token Service (STS) & Temporary Credential Workflows

Long-term static security credentials—such as IAM user access keys and secret keys—represent one of the most severe attack vectors in cloud security. If hardcoded into application source code, committed to public repositories, or leaked via compromised developer workstations, static credentials give adversaries persistent, unmonitored access to AWS environments. The AWS Security Token Service (STS) eliminates this vulnerability by providing a globally distributed, cryptographically robust web service that vends temporary, short-lived security credentials .

A rigorous understanding of STS API operations, temporary credential anatomy, session policies, session duration boundaries, role chaining limitations, and S3 presigned URL mechanics is essential for passing the AWS Certified Security – Specialty exam.

AWS STS Architecture & Temporary Credential Anatomy

AWS STS enables trusted entities (IAM users, federated identities, AWS services, and external workloads) to request ephemeral credentials on demand. Unlike static IAM credentials, temporary credentials are not stored in the IAM database and do not require manual rotation.

Anatomy of Temporary Credentials

Whenever STS successfully processes an authentication request, it returns a response payload containing four critical elements:

AccessKeyId : A unique string identifying the temporary credential. Crucial Exam Indicator : Temporary access key IDs always begin with the prefix ASIA (e.g., ASIAQWERTYUIOP123456 ), whereas long-term IAM user access keys begin with the prefix AKIA (e.g., AKIAIOSFODNN7EXAMPLE ).

SecretAccessKey : The cryptographic secret used to calculate HMAC signatures for AWS Signature Version 4 (SigV4) requests.

SessionToken : An encrypted, variable-length token string containing internal cryptographic session metadata, expiration time, and security constraints. When making API calls with temporary credentials, the SessionToken must be passed in the X-Amz-Security-Token HTTP header or query string.

Expiration : An ISO 8601 UTC timestamp indicating the exact date and time when the credentials become invalid. Once this timestamp passes, any AWS API call made with these credentials fails immediately with an ExpiredTokenException .

Comprehensive Comparative Analysis of STS API Operations

AWS STS provides five core API operations. Each operation serves a distinct architectural use case and enforces specific constraints:

STS API Operation Who Calls It? Target / Mechanism Max Duration Session Policy? Supports MFA? Primary Security Use Case

AssumeRole IAM User, Role, or AWS Service Assumes an IAM Role in the same or another account. 15m to 12h (default 1h) Yes Yes ( SerialNumber , TokenCode ) Cross-account access, EC2 instance profiles, Lambda execution roles, CI/CD pipelines.

AssumeRoleWithWebIdentity Unauthenticated Client or Workload Exchanges an OIDC / JWT token (Google, Cognito, GitHub Actions, EKS IRSA) for an IAM Role. 15m to 12h (default 1h) Yes No (handled by IdP) Modern web/mobile applications, Kubernetes pods (IRSA), GitHub Actions CI/CD without static AWS keys.

AssumeRoleWithSAML Unauthenticated Client / Browser Exchanges an XML-based SAML 2.0 assertion from an enterprise IdP for an IAM Role. 15m to 12h (default 1h) Yes No (handled by IdP) Enterprise Single Sign-On (Active Directory, Okta, PingIdentity) directly to AWS console or CLI.

GetSessionToken IAM User with long-term credentials Generates temporary credentials for the same IAM user . 15m to 36h (default 12h; root user max 1h) No Yes (Primary purpose) Adding MFA enforcement to IAM user CLI sessions; isolating sensitive operations.

GetFederationToken IAM User with long-term credentials Creates temporary credentials for a custom federated user name. 15m to 36h (default 12h) Yes (without one, the session has no permissions) No Custom on-premises identity broker proxying access to AWS resources without native SAML.

Loading diagram...

Key Differences Between Operations for the Exam

Credentials to Call : AssumeRole and GetSessionToken require valid AWS credentials to call. In contrast, AssumeRoleWithWebIdentity and AssumeRoleWithSAML do not require prior AWS credentials; the caller presents an external cryptographic token (OIDC JWT or SAML assertion) directly to STS.

GetSessionToken vs. AssumeRole : GetSessionToken does not assume a role. It returns temporary credentials for the existing IAM user who called it. Crucially, GetSessionToken does not support session policies . To scope down permissions dynamically, you must use AssumeRole or GetFederationToken .

Session Policies: Mathematical Intersection & Runtime Scoping

When assuming a role via AssumeRole , AssumeRoleWithWebIdentity , or AssumeRoleWithSAML , the caller can optionally pass an inline or managed Session Policy as a parameter in the API call.

Mathematical Intersection Logic

A session policy is an advanced authorization tool used to scope down permissions dynamically at runtime. The fundamental rule of session policies is mathematical intersection : Effective Permissions = [Role Identity-Based Policies] INTERSECT [Session Policy]

Loading diagram...

Practical Security Rules for Session Policies

Permissions Can Only Be Restricted, Never Expanded : If an IAM role has AdministratorAccess and the caller passes a session policy allowing only s3:GetObject on my-bucket , the resulting session can only execute s3:GetObject on my-bucket . Conversely, if the role allows only s3:GetObject and the caller passes a session policy allowing s3:* and ec2:* , the effective permission remains strictly s3:GetObject . A session policy can never grant permissions that the underlying role does not already possess.

Explicit Deny Precedence : If either the role policy OR the session policy contains an explicit Deny , the request is denied unconditionally.

Use Case : Multi-tenant SaaS applications where a single shared worker role assumes itself or a downstream role, passing a dynamic session policy that restricts access strictly to the tenant's specific S3 prefix or DynamoDB partition key.

  • Role Session Duration & The Role Chaining Boundary
  • Session Duration Configuration

When an IAM role is created, its default maximum session duration is 1 hour . An administrator can modify this setting on the role up to 12 hours using the MaxSessionDuration attribute.

When a caller invokes AssumeRole , they specify the DurationSeconds parameter.

The requested DurationSeconds must be between 900 seconds (15 minutes) and the role's configured MaxSessionDuration .

If a caller requests a DurationSeconds greater than the role's MaxSessionDuration , the call fails with a ValidationError .

The 1-Hour Role Chaining Limitation

Role Chaining occurs when an assumed role session uses its temporary credentials to assume another IAM role (e.g., Role A assumes Role B, or Role A -> Role B -> Role C):

Loading diagram...

CRITICAL EXAM TRAP : In role chaining, the maximum session duration for any chained role session is strictly capped at 1 hour (3,600 seconds) , regardless of the MaxSessionDuration setting configured on the target role! Even if Role B has its MaxSessionDuration set to 12 hours, when Role A assumes Role B, any request for a session duration longer than 3,600 seconds will fail, and the session will expire after at most 1 hour. This AWS security design limits the blast radius of chained credential compromises.

Amazon S3 Presigned URLs & Temporary Credential Delegation

An Amazon S3 Presigned URL grants temporary read or write access to an S3 object to anyone who possesses the URL, using the cryptographic permissions of the identity that generated it. Presigned URLs are widely used in secure architectures to allow users or external systems to upload or download files directly from S3 without proxying data through application servers.

Presigned URL Expiration Rules: Static vs. Temporary Credentials

The maximum validity period of an S3 presigned URL depends strictly on the type of credentials used to generate it :

Credential Type Used to Sign URL Maximum Allowable Expiration Critical Security Behavior

IAM User Static Credentials ( AKIA... ) Up to 7 days (604,800 seconds) Standard AWS Signature Version 4 limit for static keys.

STS Temporary Credentials ( ASIA... ) Capped at the remaining lifetime of the STS session Even if the developer specifies an expiration of 7 days in the SDK call, the presigned URL becomes invalid the moment the underlying STS temporary credentials expire (an AssumeRole session lasts 1 hour by default and at most 12 hours; EC2 instance profile credentials are valid for up to about 6 hours before rotation).

Exam Scenario : An application assumes a role with the default 1-hour session and generates an S3 presigned download URL with an expiration of 24 hours ( 86400 seconds). The client tries to download the file 3 hours later and receives HTTP 403 with an expired-token error. Why? The role session that signed the URL expired after 1 hour. A presigned URL signed with temporary credentials cannot outlive those credentials. For long-lived links, sign with an IAM user's access key (up to 7 days) or use a different distribution method such as CloudFront signed URLs.

Regional STS Endpoints vs. The Global STS Endpoint

Older AWS SDKs and CLI configurations (setting legacy ) send STS requests to the global STS endpoint ( sts.amazonaws.com ). Historically that endpoint was served only from us-east-1 (N. Virginia). Since 2025, AWS serves global-endpoint requests in the caller's own Region when the workload runs in a Region that is enabled by default and uses Amazon-provided DNS. Requests from opt-in Regions , or through custom DNS that doesn't resolve to the local Region, are still served by us-east-1 . Current SDK major versions default to regional .

The Security and Resilience Risk of the Global Endpoint

Cross-Region Latency : An application running in ap-southeast-1 (Singapore) sending every AssumeRole call to us-east-1 incurs significant network latency.

Blast Radius and Single Point of Failure : Workloads whose global-endpoint requests are still served by us-east-1 (opt-in Regions, custom DNS, or on-premises callers) lose credential vending if us-east-1 is impaired.

Data Sovereignty / Compliance : Certain regulatory frameworks mandate that security credentials and API calls must never leave a specific geographic boundary (e.g., the European Union).

Activating Regional STS Endpoints

AWS provides Regional STS endpoints (e.g., sts.eu-west-1.amazonaws.com , sts.ap-northeast-1.amazonaws.com ):

Session Token Validity : Session tokens from Regional endpoints are valid in all AWS Regions. Tokens from the global endpoint are valid only in Regions enabled by default unless you change the global endpoint token version to v2 in IAM account settings.

Configuration : Applications should set the environment variable AWS_STS_REGIONAL_ENDPOINTS=regional or configure the AWS SDK client to use the regional endpoint.

Fault Isolation : If us-east-1 experiences an outage, workloads using Regional STS endpoints in other Regions continue obtaining temporary credentials. Make sure each Regional endpoint is active in IAM account settings (Regions enabled by default have it active).

Specialty Exam Pitfalls & Architectural Traps

Role Chaining Beyond 1 Hour : Questions describing cross-account deployment pipelines where an orchestration role assumes an intermediate role, which then assumes an environment admin role, frequently test session duration. Remember: the chained session cannot exceed 1 hour .

Session Policies Cannot Escalate Privileges : If a question suggests using a session policy to grant an assumed role additional permissions that the role itself does not possess, that option is false. Session policies only filter/intersect.

STS GetSessionToken Does Not Support Session Policies : Attempting to pass a session policy to GetSessionToken causes an API validation exception. Use AssumeRole or GetFederationToken when session policy restriction is needed.

Revoking Active STS Sessions : Once an STS temporary credential is vended, it cannot be directly deleted or revoked via a simple API call . To immediately invalidate an active temporary credential session, an administrator must attach an inline policy to the role containing a condition that denies access based on the aws:TokenIssueTime condition key (e.g., denying all actions where aws:TokenIssueTime is earlier than the revocation timestamp).

Loading diagram... STS AssumeRole Workflow, Session Policy Evaluation & Temporary Credential Vending