User guide

Table of Contents
What is the AWS SDK for Java? ....................................................................................................... 1
About the AWS SDK for Java ................................................................................................... 1
Browse the Source at GitHub .......................................................................................... 1
Developing AWS Applications for Android .......................................................................... 2
What's in this Guide? ............................................................................................................. 2
Viewing the Revision History for the SDK for Java ....................................................................... 2
About Amazon Web Services .................................................................................................. 3
Getting Started ............................................................................................................................. 4
Sign Up for Amazon Web Services and Get AWS Credentials ....................................................... 4
Install a Java Development Environment .................................................................................... 5
Install the AWS SDK for Java ................................................................................................... 5
Using the SDK for Java with Apache Maven ............................................................................... 6
Configuring the SDK as a Maven dependency .................................................................... 6
Building the SDK with Maven ........................................................................................... 6
Set Up your AWS Credentials for Use with the SDK for Java ......................................................... 7
Explore the SDK for Java Code Samples ................................................................................... 8
Where to Go from Here .......................................................................................................... 8
AWS SDK for Java Basics ............................................................................................................... 9
Providing Credentials ............................................................................................................. 9
Using the Default Credential Provider Chain ..................................................................... 10
Specifying a Credential Provider or Provider Chain ............................................................ 12
Explicitly Specifying Credentials ..................................................................................... 12
See Also .................................................................................................................... 13
AWS Region Selection .......................................................................................................... 13
Checking for Service Availability in an AWS Region ........................................................... 13
Choosing a Region ...................................................................................................... 13
Choosing a Specific Endpoint ........................................................................................ 14
Developing Code that Accesses Multiple AWS Regions ...................................................... 14
Client Networking Configuration ............................................................................................. 14
Proxy Configuration ...................................................................................................... 14
HTTP Transport Configuration ........................................................................................ 15
TCP Socket Buffer Size Hints ......................................................................................... 16
Setting the JVM TTL for DNS Name Lookups ........................................................................... 16
Exception Handling .............................................................................................................. 17
Logging ............................................................................................................................. 18
Setting the Classpath ................................................................................................... 18
Service-Specific Errors and Warnings ............................................................................. 19
Request/Response Summary Logging ............................................................................ 19
Verbose Wire Logging .................................................................................................. 20
Access Control Policies ......................................................................................................... 20
Using AWS Services .................................................................................................................... 23
DynamoDB ......................................................................................................................... 23
Manage Tomcat Session State with DynamoDB ................................................................ 23
Amazon EC2 ...................................................................................................................... 26
Tutorial: Starting an EC2 Instance ................................................................................... 26
Using IAM Roles for EC2 Instances ................................................................................ 30
Tutorial: Amazon EC2 Spot Instances .............................................................................. 35
Tutorial: Advanced Amazon EC2 Spot Request Management .............................................. 44
Getting Temporary AWS Credentials with SWS STS .................................................................. 61
(Optional) Activate and use an AWS STS region ............................................................... 62
Retrieve temporary security credentials from AWS STS ...................................................... 62
Use the temporary credentials to access AWS resources .................................................... 63
For more information .................................................................................................... 64
Amazon SWF ...................................................................................................................... 64
Registering an Amazon SWF Domain ............................................................................. 64
Version v1.0.0
iii
AWS SDK for Java Developer Guide