Amazon AWS SDK Betriebsanweisung

Stöbern Sie online oder laden Sie Betriebsanweisung nach Software Amazon AWS SDK herunter. Amazon AWS SDK User guide Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 76
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 0
AWS SDK for Java
Developer Guide
Version v1.0.0
Seitenansicht 0
1 2 3 4 5 6 ... 75 76

Inhaltsverzeichnis

Seite 1 - AWS SDK for Java

AWS SDK for JavaDeveloper GuideVersion v1.0.0

Seite 2

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

Seite 3 - Table of Contents

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

Seite 4

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

Seite 5 - What is the AWS SDK for Java?

AWS SDK for Java BasicsThis section provides important general information about programming with the AWS SDK for Java.Information in this section app

Seite 6 - What's in this Guide?

Topics• Using the Default Credential Provider Chain (p. 10)• Specifying a Credential Provider or Provider Chain (p.12)• Explicitly Specifying Credenti

Seite 7 - About Amazon Web Services

To override the default credentials file location• Set the AWS_CREDENTIAL_FILE environment variable to the location of your AWS credentials file.On Li

Seite 8 - Getting Started

Specifying a Credential Provider or Provider ChainIf you want to specify a different credential provider than the default credential provider chain, y

Seite 9 - Install the AWS SDK for Java

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

Seite 10 - Building the SDK with Maven

AmazonEC2 ec2 = new AmazonEC2(myCredentials);ec2.setRegion(Region.getRegion(Regions.US_WEST_2));ImportantAmazonWebServiceClient.setRegion is not threa

Seite 11 - SDK for Java

If you're connecting to the Internet through a proxy server, you'll need to configure your proxy serversettings (proxy host, port and userna

Seite 12 - Where to Go from Here

AWS SDK for Java: Developer GuideCopyright © 2015 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.The following are trademarks of

Seite 13 - AWS SDK for Java Basics

TCP Socket Buffer Size HintsAdvanced users who want to tune low-level TCP parameters can additionally set TCP buffer size hintsthrough the ClientConfi

Seite 14 - Setting Credentials

java.security.Security.setProperty("networkaddress.cache.ttl" , "60");Note that the JVM is a shared resource; multiple Java applic

Seite 15 - Loading Credentials

AmazonClientExceptionThis exception indicates that a problem occurred inside the Java client code, either while trying to senda request to AWS or whil

Seite 16

<fileset dir="../../third-party" includes="**/*.jar"/> <fileset dir="../../lib" includes="**/*.jar"

Seite 17 - AWS Region Selection

POST https://rds.amazonaws.com / Parameters: (MaxRecords: 20, Action: Descri beEngineDefaultParameters, SignatureMethod: HmacSHA256, AWSAccessKeyId: A

Seite 18 - Proxy Configuration

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

Seite 19 - HTTP Transport Configuration

AmazonSQS sqs = new AmazonSQSClient(myAwsCredentials);sqs.setQueueAttributes(new SetQueueAttributesRequest(myQueueUrl, queueAttrib utes));Amazon SNS E

Seite 20 - TCP Socket Buffer Size Hints

Using Amazon Web Services withthe AWS SDK for JavaThis section provides information about how to program various Amazon Web Services using the SDKfor

Seite 21 - Exception Handling

Downloading the Session ManagerYou can download the session manager from the aws/aws-dynamodb-session-tomcat project on GitHub.That project also hosts

Seite 22 - Setting the Classpath

• 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

Seite 23

Table of ContentsWhat is the AWS SDK for Java? ...

Seite 24 - Access Control Policies

TroubleshootingIf you encounter issues with the session manager, the first place to look is in catalina.out. If you haveaccess to the Tomcat installat

Seite 25

AWSCredentials credentials = new PropertiesCredentials( AwsConsoleApp.class.getResourceAsStream("AwsCredentials.proper ties"));2. Us

Seite 26 - Amazon SNS Example

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

Seite 27 - DynamoDB

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

Seite 28

.withMaxCount(1) .withKeyName("my-key-pair") .withSecurityGroups("my-secur

Seite 29

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.

Seite 30 - Limitations

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

Seite 31 - To create a security group

} catch(AmazonClientException ace) { System.out.println( "AmazonClientException" ); } } private static void displayTextI

Seite 32

run: [java] Downloading an object [java] AmazonServiceExceptionBUILD SUCCESSFULTransfer the Compiled Program to Your EC2 InstanceTransfer the prog

Seite 33 - Run an Amazon EC2 Instance

Tutorial: Amazon EC2 Spot InstancesOverviewSpot Instances allow you to bid on unused Amazon Elastic Compute Cloud (Amazon EC2) capacity andrun the acq

Seite 34 - Resources on Amazon EC2

Listing Amazon SWF Domains ... 65Additional Resources ...

Seite 35 - Create an IAM Role

Step 1: Setting Up Your CredentialsTo begin using this code sample, you need to populate your credentials in theAwsCredentials.properties file. Specif

Seite 36 - Create your Application

After we create an AmazonEC2 client object, we create a CreateSecurityGroupRequest object withthe name, "GettingStarted" and a description f

Seite 37 - For example:

ipPermission.setFromPort(new Integer(22)); ipPermission.setToPort(new Integer(22)); ipPermission.setIpRanges(ipRanges); ipPermissions.add

Seite 38

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

Seite 39 - Prerequisites

RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); // Request 1 x t1.micro instance with a bid price of $0.03.

Seite 40

10 // active state. for (SpotInstanceRequest requestResponse : requestResponses) { System.out.println("Created Spot Request: "+re

Seite 41

} catch (Exception e) { // Do nothing because it woke up early. } 45 } while (anyOpen); After running this code, your Spot I

Seite 42

try { // Retrieve all of the requests we want to monitor. 20 DescribeSpotInstanceRequestsResult describeResult = ec2.descri

Seite 43

Bringing It All TogetherTo bring this all together, we provide a more object-oriented approach that combines the preceding stepswe showed: initializin

Seite 44

Step 1: Setting Up Your CredentialsTo begin using this code sample, you need to populate your credentials in theAwsCredentials.properties file. Specif

Seite 45

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

Seite 46

After we create an AmazonEC2 client object, we create a CreateSecurityGroupRequest object withthe name, "GettingStarted" and a description f

Seite 47

ArrayList<IpPermission> ipPermissions = new ArrayList<IpPermission> (); 45 IpPermission ipPermission = new IpPermission(); ipPermis

Seite 48 - Management

// Initializes a Spot Instance Request RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); // Request 1 x t1.mi

Seite 49

// Initializes a Spot Instance Request RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); 20 // Request 1 x t1.mi

Seite 50

// Initializes a Spot Instance Request RequestSpotInstancesRequest requestRequest = new RequestSpotInstances Request(); // Request 1 x t1.mi

Seite 51

GettingStartedApp.class.getResourceAsStream("AwsCredentials.proper ties")); } catch (IOException e1) { System.out.prin

Seite 52

} catch (IOException e1) { System.out.println("Credentials were not properly entered into AwsCre dentials.properties."); S

Seite 53

} // Create the AmazonEC2Client object so we can call various APIs. AmazonEC2 ec2 = new AmazonEC2Client(credentials); 15 // Initializes

Seite 54

10 System.exit(-1); } // Create the AmazonEC2Client object so we can call various APIs. AmazonEC2 ec2 = new AmazonEC2Client(credentials)

Seite 55

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

Seite 56

Developing AWS Applications for AndroidIf you are an Android developer, Amazon Web Services publishes a separate SDK specifically for Androiddevelopme

Seite 57

blockList.add(blockDeviceMapping);// Set the block device mapping configuration in the launch specifications. 50 launchSpecification.setBlockDeviceMap

Seite 58 - Termination

import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.PropertiesCredentials; 25 import com.amazonaws.codesamples.getting_started.

Seite 59

System.out.println(e1.getMessage()); System.exit(-1); } 80 // Create the AmazonEC2Client object so we can // call

Seite 60

130 // Create the list of tags we want to createArrayList<Tag> requestTags = new ArrayList<Tag>();requestTags.add(new Tag("keynam

Seite 61

if (describeResponse.getState().equals("open")) {185 anyOpen = true; break; }

Seite 62

} catch (AmazonServiceException e) { // Write out any exceptions that may have occurred. System.out.println("Error canc

Seite 63

2. Retrieve temporary security credentials from AWS STS.3. Use the credentials to access AWS resources.NoteActivating a region is optional; by default

Seite 64

GetSessionTokenRequest session_token_request = new GetSessionTokenRequest();session_token_request.setDurationSeconds(7200); // optional.The duration o

Seite 65 - Bringing It All Together

For more informationFor more information about how to use temporary security credentials to access AWS resources, visitthe following sections in the A

Seite 66 - Important

}}Listing Amazon SWF Domains Using the AWS SDKfor JavaYou can list the Amazon SWF domains associated with your account and AWS region by registrat

Seite 67

About Amazon Web ServicesAmazon Web Services (AWS) is a collection of digital infrastructure services that developers can leveragewhen developing thei

Seite 68 - For more information

Additional ResourcesThis section lists sources of additional information about using Amazon Web Services and the AWS SDKfor Java.Topics• Home Page for

Seite 69 - To list Amazon SWF domains

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

Seite 70 - Additional Resources

Code SamplesDemonstrates how to make basic requests toAmazon DynamoDB.AmazonDynamoDBContains a number of 'quickstart' samples for Dy-namoDB,

Seite 71 - AWS SDK for Java Code Samples

These samples demonstrate how to use AWS FlowFramework.The following samples are included:• HelloWorld – this sample includes a simpleworkflow that ca

Seite 72 - Code Samples

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

Seite 73 - Command Line

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

Seite 74 - Eclipse IDE

Document HistoryThe following table describes the important changes since the last release of the AWS SDK for JavaDeveloper Guide.Last documentation u

Seite 75 - To run the project

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

Seite 76 - Document History

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

Keine Kommentare