2022-10-20 15:00:56 -04:00
# AWS STS code examples for the SDK for C++
2022-09-30 09:16:28 -04:00
## Overview
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
Shows how to use the AWS SDK for C++ to work with AWS Security Token Service (AWS STS).
2022-09-30 09:16:28 -04:00
2024-01-04 10:14:09 -05:00
<!--custom.overview.start-->
<!--custom.overview.end-->
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
_ AWS STS creates and provides trusted users with temporary security credentials that can control access to your AWS resources. _
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
## ⚠ Important
2024-01-09 12:33:12 -05:00
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing ](https://aws.amazon.com/pricing/ ) and [Free Tier ](https://aws.amazon.com/free/ ).
2022-09-30 09:16:28 -04:00
* Running the tests might result in charges to your AWS account.
2024-01-04 10:14:09 -05:00
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege ](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege ).
2022-09-30 09:16:28 -04:00
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services ](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services ).
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
<!--custom.important.start-->
<!--custom.important.end-->
2022-09-30 09:16:28 -04:00
2024-01-04 10:14:09 -05:00
## Code examples
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
### Prerequisites
2022-10-20 15:00:56 -04:00
2022-09-30 09:16:28 -04:00
2022-10-20 15:00:56 -04:00
2022-09-30 09:16:28 -04:00
Before using the code examples, first complete the installation and setup steps
2024-01-04 10:14:09 -05:00
for [Getting started ](https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/getting-started.html ) in the AWS SDK for
2022-09-30 09:16:28 -04:00
C++ Developer Guide.
This section covers how to get and build the SDK, and how to build your own code by using the SDK with a
sample Hello World-style application.
2022-09-30 14:55:56 -04:00
Next, for information on code example structures and how to build and run the examples, see [Getting started with the AWS SDK for C++ code examples ](https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/getting-started-code-examples.html ).
2022-09-30 09:16:28 -04:00
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->
### Single actions
Code excerpts that show you how to call individual service functions.
2024-04-30 12:22:08 -07:00
- [AssumeRole ](assume_role.cpp#L37 )
2024-01-04 10:14:09 -05:00
<!--custom.examples.start-->
<!--custom.examples.end-->
## Run the examples
### Instructions
2024-02-08 15:35:59 -05:00
An executable is built for each source file in this folder. These executables are located in the build folder and have
2024-01-04 10:14:09 -05:00
"run_" prepended to the source file name, minus the suffix. See the "main" function in the source file for further instructions.
For example, to run the action in the source file "my_action.cpp", execute the following command from within the build folder. The command
will display any required arguments.
```
./run_my_action
```
2024-02-08 15:35:59 -05:00
If the source file is in a different folder, instructions can be found in the README in that
folder.
2024-01-04 10:14:09 -05:00
<!--custom.instructions.start-->
<!--custom.instructions.end-->
### Tests
⚠ Running tests might result in charges to your AWS account.
2022-09-30 09:16:28 -04:00
2022-09-30 14:55:56 -04:00
``` sh
cd <BUILD_DIR>
cmake <path-to-root-of-this-source-code> -DBUILD_TESTS= ON
make
2024-01-04 10:14:09 -05:00
ctest
```
<!--custom.tests.start-->
<!--custom.tests.end-->
2022-09-30 09:16:28 -04:00
## Additional resources
2022-10-20 15:00:56 -04:00
2024-01-04 10:14:09 -05:00
- [AWS STS User Guide ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html )
- [AWS STS API Reference ](https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html )
- [SDK for C++ AWS STS reference ](https://sdk.amazonaws.com/cpp/api/LATEST/aws-cpp-sdk-sts/html/annotated.html )
<!--custom.resources.start-->
<!--custom.resources.end-->
---
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2022-09-30 09:16:28 -04:00
2024-01-04 10:14:09 -05:00
SPDX-License-Identifier: Apache-2.0