User guide

If you intend to use the SDK for Java with the Eclipse IDE, you should install the AWS Toolkit for Eclipse,
which automatically includes the AWS SDK for Java. For information about how to obtain, install and set
up the Toolkit for Eclipse, see Setting Up the AWS Toolkit for Eclipse in the AWS Toolkit for Eclipse
Getting Started Guide.
If you intend to build using Ant and the command-line, or will be using an IDE other than Eclipse, you can
set up the Java SDK as shown here.
To download and install the AWS SDK for Java
1. Download the AWS SDK for Java from the SDK web page at http://aws.amazon.com/sdkforjava.
2. After downloading the SDK, extract the contents into a directory.
Set up your AWS Credentials for Use with the
SDK for Java
To connect to any of the supported services with the SDK for Java, you must provide your AWS credentials.
The AWS SDKs and CLIs use provider chains to look for AWS credentials in a number of different places,
including system or user environment variables and local AWS configuration files.
Setting your credentials for use by the SDK for Java can be done in a number of ways, but here are the
recommended approaches:
To set credentials for your local user (login), use the AWS CLI to set credentials with the following
command:
aws cli configure
The CLI will store credentials that are specified this way in a local file, typically ~/.aws/config.
To set credentials for a particular terminal (command-line) session, set the AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY environment variables.
To set these variables in Linux, OS X, or Unix, use export:
export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
To set these variables in Windows, use set:
set AWS_ACCESS_KEY_ID=your_access_key_id
set AWS_SECRET_ACCESS_KEY=your_secret_access_key
To set credentials for an EC2 instance, you should specify an IAM role and then give your EC2 instance
access to that role as shown in Using IAM Roles for EC2 Instances (p. 29).
Once you have set your AWS credentials using one of these methods, they can be loaded automatically
by the SDK for Java by using the default credential provider chain. For complete information about how
to load and use AWS credentials in your SDK for Java applications, see Providing Credentials (p. 8).
Version v1.0.0
6
AWS SDK for Java Developer Guide
Set up your AWS Credentials for Use with the SDK for
Java