

# Code examples for AWS STS using AWS SDKs
<a name="service_code_examples_sts"></a>

The following code examples show how to use AWS STS with an AWS software development kit (SDK). 

*Actions* are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

*Scenarios* are code examples that show you how to accomplish specific tasks by calling multiple functions within a service or combined with other AWS services.

For a complete list of AWS SDK developer guides and code examples, see [Using this service with an AWS SDK](sdk-general-information-section.md). This topic also includes information about getting started and details about previous SDK versions.

**Contents**
+ [Basics](service_code_examples_sts_basics.md)
  + [Actions](service_code_examples_sts_actions.md)
    + [`AssumeRole`](sts_example_sts_AssumeRole_section.md)
    + [`AssumeRoleWithWebIdentity`](sts_example_sts_AssumeRoleWithWebIdentity_section.md)
    + [`DecodeAuthorizationMessage`](sts_example_sts_DecodeAuthorizationMessage_section.md)
    + [`GetFederationToken`](sts_example_sts_GetFederationToken_section.md)
    + [`GetSessionToken`](sts_example_sts_GetSessionToken_section.md)
+ [Scenarios](service_code_examples_sts_scenarios.md)
  + [Assume an IAM role that requires an MFA token](sts_example_sts_Scenario_AssumeRoleMfa_section.md)
  + [Configure container service connectivity](sts_example_ecs_ServiceConnect_085_section.md)
  + [Construct a URL for federated users](sts_example_sts_Scenario_ConstructFederatedUrl_section.md)
  + [Create a container task for the serverless launch type](sts_example_ecs_GettingStarted_086_section.md)
  + [Create a rest API with function proxy integration](sts_example_api_gateway_GettingStarted_087_section.md)
  + [Creating a container service for virtual machine instances](sts_example_ecs_GettingStarted_018_section.md)
  + [Creating a managed monitoring workspace](sts_example_iam_GettingStarted_044_section.md)
  + [Creating a monitoring dashboard with function name as a variable](sts_example_cloudwatch_GettingStarted_031_section.md)
  + [Get a session token that requires an MFA token](sts_example_sts_Scenario_SessionTokenMfa_section.md)
  + [Getting started with configuration management](sts_example_config_service_GettingStarted_053_section.md)
  + [Getting started with container registries](sts_example_ecr_GettingStarted_078_section.md)
  + [Getting started with internet of things messaging](sts_example_iot_GettingStarted_063_section.md)
  + [Getting started with machine learning feature stores](sts_example_iam_GettingStarted_028_section.md)
  + [Getting started with managed kubernetes clusters](sts_example_eks_GettingStarted_034_section.md)
  + [Getting started with managed streaming](sts_example_ec2_GettingStarted_057_section.md)
  + [Getting started with push notifications](sts_example_pinpoint_GettingStarted_049_section.md)
  + [Getting started with search and analytics engines](sts_example_opensearch_GettingStarted_016_section.md)
  + [Getting started with web application firewalls](sts_example_wafv2_GettingStarted_052_section.md)
  + [Moving hardcoded secrets to secure secret storage](sts_example_secrets_manager_GettingStarted_073_section.md)
  + [Run CPU stress tests on virtual machine instances using fault injection](sts_example_iam_GettingStarted_069_section.md)
  + [Setting up systems management](sts_example_iam_GettingStarted_046_section.md)