Providing AWS Credentials - AWS SDK for C++

Providing AWS Credentials

To connect to any of the supported services with the AWS SDK for C++, you must provide AWS credentials. The AWS SDKs and CLIs use provider chains to look for AWS credentials in several different places, including system/user environment variables and local AWS configuration files. For details, see Credentials Providers in the aws-sdk-cpp repository in GitHub.

Create an AWS account

To create an AWS account, see How do I create and activate a new Amazon Web Services account?

Create AWS credentials and a profile

To use the SDK, you need to create an AWS Identity and Access Management (IAM) user and obtain credentials for that user. After you have those credentials, you make them available to the SDK in your development environment. Here's how.

To create and use credentials

  1. Sign in to the AWS Management Console and open the IAM console at

  2. Choose Users, and then choose Add user.

  3. Provide a user name. For this tutorial, we'll use SdkUser.

  4. Under Select AWS access type, select Programmatic access, and then choose Next: Permissions.

  5. Choose Attach existing policies directly.

  6. In Search, enter s3, and then select AmazonS3FullAccess.

  7. Choose Next: Tags, Next: Review, and Create user.

  8. On the Success screen, choose Download .csv.

    The downloaded file contains the Access Key ID and the Secret Access Key for this IAM user. Treat your Secret Access Key as a password; save in a trusted location and do not share it.


    You will not have another opportunity to download or copy the Secret Access Key.

  9. Save the file in the appropriate location for your operating system. See Location of Credentials Files.

The preceding procedure is the simplest of several possibilities for authentication and authorization. For other options, see below.

More information on user credentials

To explore other ways to provide credentials to SDKs, see the following: