AWS SDK for JavaDeveloper GuideVersion v1.0.0
To download and install the SDK for Java1. Download the SDK for Java from the SDK web page at http://aws.amazon.com/sdkforjava.2. After downloading th
Set Up your AWS Credentials for Use with theSDK for JavaTo connect to any of the supported services with the SDK for Java, you must provide your AWS c
Explore the SDK for Java Code SamplesThe SDK for Java is packaged with a number of code samples, which you can browse on your machineor view on GitHub
AWS SDK for Java BasicsThis section provides important general information about programming with the AWS SDK for Java.Information in this section app
Topics• Using the Default Credential Provider Chain (p. 10)• Specifying a Credential Provider or Provider Chain (p.12)• Explicitly Specifying Credenti
To override the default credentials file location• Set the AWS_CREDENTIAL_FILE environment variable to the location of your AWS credentials file.On Li
Specifying a Credential Provider or Provider ChainIf you want to specify a different credential provider than the default credential provider chain, y
See Also• Sign Up for Amazon Web Services and Get AWS Credentials (p. 4)• Set Up your AWS Credentials for Use with the SDK for Java (p.7)• Using IAM R
AmazonEC2 ec2 = new AmazonEC2(myCredentials);ec2.setRegion(Region.getRegion(Regions.US_WEST_2));ImportantAmazonWebServiceClient.setRegion is not threa
If you're connecting to the Internet through a proxy server, you'll need to configure your proxy serversettings (proxy host, port and userna
AWS SDK for Java: Developer GuideCopyright © 2015 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.The following are trademarks of
TCP Socket Buffer Size HintsAdvanced users who want to tune low-level TCP parameters can additionally set TCP buffer size hintsthrough the ClientConfi
java.security.Security.setProperty("networkaddress.cache.ttl" , "60");Note that the JVM is a shared resource; multiple Java applic
AmazonClientExceptionThis exception indicates that a problem occurred inside the Java client code, either while trying to senda request to AWS or whil
<fileset dir="../../third-party" includes="**/*.jar"/> <fileset dir="../../lib" includes="**/*.jar"
POST https://rds.amazonaws.com / Parameters: (MaxRecords: 20, Action: Descri beEngineDefaultParameters, SignatureMethod: HmacSHA256, AWSAccessKeyId: A
A is the principalThe AWS account that is making a request to access or modify one of your AWS resources.B is the actionThe way in which your AWS reso
AmazonSQS sqs = new AmazonSQSClient(myAwsCredentials);sqs.setQueueAttributes(new SetQueueAttributesRequest(myQueueUrl, queueAttrib utes));Amazon SNS E
Using Amazon Web Services withthe AWS SDK for JavaThis section provides information about how to program various Amazon Web Services using the SDKfor
Downloading the Session ManagerYou can download the session manager from the aws/aws-dynamodb-session-tomcat project on GitHub.That project also hosts
• A config file that copies the jar into Tomcat's lib directory and applies the overridden context.xmlfile.You can find in more information on cu
Table of ContentsWhat is the AWS SDK for Java? ...
TroubleshootingIf you encounter issues with the session manager, the first place to look is in catalina.out. If you haveaccess to the Tomcat installat
AWSCredentials credentials = new PropertiesCredentials( AwsConsoleApp.class.getResourceAsStream("AwsCredentials.proper ties"));2. Us
If you attempt to create a security group with the same name as an existing security group,createSecurityGroup throws an exception.By default, a new s
Create a Key PairYou must specify a key pair when you launch an EC2 instance and then specify the private key of thekey pair when you connect to the i
.withMaxCount(1) .withKeyName("my-key-pair") .withSecurityGroups("my-secur
1. In system environment variables:AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.2. In the Java system properties: aws.accessKeyId and aws.secretKey.3.
5. On the Set Permissions page, under Select Policy Template, select Amazon S3 Read OnlyAccess. Click Next Step.6. On the Review page, click Create Ro
} catch(AmazonClientException ace) { System.out.println( "AmazonClientException" ); } } private static void displayTextI
run: [java] Downloading an object [java] AmazonServiceExceptionBUILD SUCCESSFULTransfer the Compiled Program to Your EC2 InstanceTransfer the prog
Tutorial: Amazon EC2 Spot InstancesOverviewSpot Instances allow you to bid on unused Amazon Elastic Compute Cloud (Amazon EC2) capacity andrun the acq
Listing Amazon SWF Domains ... 65Additional Resources ...
Step 1: Setting Up Your CredentialsTo begin using this code sample, you need to populate your credentials in theAwsCredentials.properties file. Specif
After we create an AmazonEC2 client object, we create a CreateSecurityGroupRequest object withthe name, "GettingStarted" and a description f
ipPermission.setFromPort(new Integer(22)); ipPermission.setToPort(new Integer(22)); ipPermission.setIpRanges(ipRanges); ipPermissions.add
There are many ways to approach bidding for Spot instances; to get a broad overview of the variousapproaches you should view the Bidding for Spot Inst
RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); // Request 1 x t1.micro instance with a bid price of $0.03.
10 // active state. for (SpotInstanceRequest requestResponse : requestResponses) { System.out.println("Created Spot Request: "+re
} catch (Exception e) { // Do nothing because it woke up early. } 45 } while (anyOpen); After running this code, your Spot I
try { // Retrieve all of the requests we want to monitor. 20 DescribeSpotInstanceRequestsResult describeResult = ec2.descri
Bringing It All TogetherTo bring this all together, we provide a more object-oriented approach that combines the preceding stepswe showed: initializin
Step 1: Setting Up Your CredentialsTo begin using this code sample, you need to populate your credentials in theAwsCredentials.properties file. Specif
What is the AWS SDK for Java?The AWS SDK for Java provides a Java API for AWS infrastructure services. Using the SDK for Java,you can build applicatio
After we create an AmazonEC2 client object, we create a CreateSecurityGroupRequest object withthe name, "GettingStarted" and a description f
ArrayList<IpPermission> ipPermissions = new ArrayList<IpPermission> (); 45 IpPermission ipPermission = new IpPermission(); ipPermis
// Initializes a Spot Instance Request RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); // Request 1 x t1.mi
// Initializes a Spot Instance Request RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); 20 // Request 1 x t1.mi
// Initializes a Spot Instance Request RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); // Request 1 x t1.mi
GettingStartedApp.class.getResourceAsStream("AwsCredentials.proper ties")); } catch (IOException e1) { System.out.prin
} catch (IOException e1) { System.out.println("Credentials were not properly entered into AwsCre dentials.properties."); S
} // Create the AmazonEC2Client object so we can call various APIs. AmazonEC2 ec2 = new AmazonEC2Client(credentials); 15 // Initializes
10 System.exit(-1); } // Create the AmazonEC2Client object so we can call various APIs. AmazonEC2 ec2 = new AmazonEC2Client(credentials)
interruption or termination.We've inserted new code in the following example that shows how to enablethis scenario.In the added code, we create a
Developing AWS Applications for AndroidIf you are an Android developer, Amazon Web Services publishes a separate SDK specifically for Androiddevelopme
blockList.add(blockDeviceMapping);// Set the block device mapping configuration in the launch specifications. 50 launchSpecification.setBlockDeviceMap
import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.PropertiesCredentials; 25 import com.amazonaws.codesamples.getting_started.
System.out.println(e1.getMessage()); System.exit(-1); } 80 // Create the AmazonEC2Client object so we can // call
130 // Create the list of tags we want to createArrayList<Tag> requestTags = new ArrayList<Tag>();requestTags.add(new Tag("keynam
if (describeResponse.getState().equals("open")) {185 anyOpen = true; break; }
} catch (AmazonServiceException e) { // Write out any exceptions that may have occurred. System.out.println("Error canc
2. Retrieve temporary security credentials from AWS STS.3. Use the credentials to access AWS resources.NoteActivating a region is optional; by default
GetSessionTokenRequest session_token_request = new GetSessionTokenRequest();session_token_request.setDurationSeconds(7200); // optional.The duration o
For more informationFor more information about how to use temporary security credentials to access AWS resources, visitthe following sections in the A
}}Listing Amazon SWF Domains Using the AWS SDKfor JavaYou can list the Amazon SWF domains associated with your account and AWS region by registrat
About Amazon Web ServicesAmazon Web Services (AWS) is a collection of digital infrastructure services that developers can leveragewhen developing thei
Additional ResourcesThis section lists sources of additional information about using Amazon Web Services and the AWS SDKfor Java.Topics• Home Page for
AWS ForumsVisit the AWS forums to ask questions or provide feedback about AWS.There is a forum specifically forAWS development in Java as well as foru
Code SamplesDemonstrates how to make basic requests toAmazon DynamoDB.AmazonDynamoDBContains a number of 'quickstart' samples for Dy-namoDB,
These samples demonstrate how to use AWS FlowFramework.The following samples are included:• HelloWorld – this sample includes a simpleworkflow that ca
Before running any of the AWS SDK for Java samples, you will need to set your AWS credentials in theenvironment or with the AWS CLI as specified in Se
2. Create a new AWS Java project. In Eclipse, on the File menu, point to New, and then click Project.The New Project wizard opens.3. Expand the AWS ca
Document HistoryThe following table describes the important changes since the last release of the AWS SDK for JavaDeveloper Guide.Last documentation u
Getting StartedThis section provides information about how to install, set up, and use the SDK for Java. If you havenever used the SDK for Java before
To provide access credentials for an IAM user1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
Kommentare zu diesen Handbüchern