Provide access credentials in environment variables

Access credentials can be read from environment variables.

Table 1. AWS .NET SDK supported variables
Variable Purpose
AWS_ACCESS_KEY_ID AWS access key.
AWS_SECRET_ACCESS_KEY AWS secret key. Access and secret key variables override credentials that are stored in both credential and config files.
AWS_SECURITY_TOKEN Security token. A web service that requests temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users).
AWS_PROFILE Name of the profile to use. It can be the name of a profile that is stored in a credential or config file or default to use the default profile.

These access credentials can be read from the environment variables:


AmazonS3 s3 = new AmazonS3Client(new
EnvironmentVariableCredentialsProvider().getCredentials());