Amazon AWS SDK Uživatelská příručka

Procházejte online nebo si stáhněte Uživatelská příručka pro Software Amazon AWS SDK. Amazon AWS SDK User guide Uživatelská příručka

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 76
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 0
AWS SDK for Java
Developer Guide
Version v1.0.0
Zobrazit stránku 0
1 2 3 4 5 6 ... 75 76

Shrnutí obsahu

Strany 1 - AWS SDK for Java

AWS SDK for JavaDeveloper GuideVersion v1.0.0

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 10 - Building the SDK with Maven

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

Strany 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

Strany 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

Strany 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

Strany 14 - Setting Credentials

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

Strany 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

Strany 16

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

Strany 17 - AWS Region Selection

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

Strany 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

Strany 19 - HTTP Transport Configuration

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

Strany 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

Strany 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

Strany 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

Strany 23

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

Strany 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

Strany 25

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

Strany 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

Strany 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

Strany 28

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

Strany 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.

Strany 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

Strany 31 - To create a security group

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

Strany 32

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

Strany 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

Strany 34 - Resources on Amazon EC2

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

Strany 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

Strany 36 - Create your Application

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

Strany 37 - For example:

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

Strany 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

Strany 39 - Prerequisites

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

Strany 40

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

Strany 41

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

Strany 42

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

Strany 43

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

Strany 44

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

Strany 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

Strany 46

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

Strany 47

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

Strany 48 - Management

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

Strany 49

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

Strany 50

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

Strany 51

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

Strany 52

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

Strany 53

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

Strany 54

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

Strany 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

Strany 56

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

Strany 57

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

Strany 58 - Termination

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

Strany 59

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

Strany 60

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

Strany 61

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

Strany 62

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

Strany 63

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

Strany 64

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

Strany 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

Strany 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

Strany 67

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

Strany 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

Strany 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

Strany 70 - Additional Resources

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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/.

Komentáře k této Příručce

Žádné komentáře