Additional setup information - AWS SDK for Java

You can now use the Amazon S3 Transfer Manager (Developer Preview) in the AWS SDK for Java 2.x for accelerated file transfers. Give it a try and let us know what you think!

Additional setup information

This topic supplements the information in Setting up the AWS SDK for Java 2.x.

Set up credentials profiles

You can use more than one set of credentials in your application by setting up additional credentials profiles. Like the [default] profile, you can set up custom profiles to use programmatic access keys as credentials or to use temporary credentials.

To configure your own credentials profiles, use the shared credentials and config files. See the snippets below for example usage.

*A profile,*cloudwatch_metrics , configured in the credentials file to use a programmatic access key as credentials:

[cloudwatch_metrics] aws_access_key_id = your_access_key_id aws_secret_access_key = your_secret_access_key region = us-east-2

A profile, devuser, configured in the config file to use temporary credentials by assuming a role based on an Amazon Resource Name (ARN).

[profile devuser] role_arn = {region-arn}iam::123456789012:role/developers source_profile = dev-user region = {region_api_default} output = json

A profile, user1, configured in the credentials file to use AWS Single Sign-On (SSO) for credentials.

[user1] sso_start_url = https://my-sso-portal.awsapps.com/start sso_region = us-east-1 sso_account_id = 123456789011 sso_role_name = readOnly region = {region_api_default}

For additional information about configuring the shared credentials and config files, see:

Set an alternate credentials file location

By default, the AWS SDK for Java looks for the credentials file at ~/.aws/credentials. To customize the location of the shared credentials file, set the AWS_SHARED_CREDENTIALS_FILE environment variable to an alternate location.

To set this variable on Linux, macOS, or Unix, use export:

export AWS_SHARED_CREDENTIALS_FILE=path/to/credentials_file

To set this variable on Windows, use set:

set AWS_SHARED_CREDENTIALS_FILE=path/to/credentials_file