Amazon AWS SDK Podręcznik Użytkownika Strona 1

Przeglądaj online lub pobierz Podręcznik Użytkownika dla Oprogramowanie Amazon AWS SDK. Amazon AWS SDK User guide Instrukcja obsługi

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 76
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 0
AWS SDK for Java
Developer Guide
Version v1.0.0
Przeglądanie stron 0
1 2 3 4 5 6 ... 75 76

Podsumowanie treści

Strona 1 - AWS SDK for Java

AWS SDK for JavaDeveloper GuideVersion v1.0.0

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 10 - Building the SDK with Maven

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

Strona 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

Strona 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

Strona 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

Strona 14 - Setting Credentials

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

Strona 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

Strona 16

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

Strona 17 - AWS Region Selection

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

Strona 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

Strona 19 - HTTP Transport Configuration

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

Strona 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

Strona 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

Strona 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

Strona 23

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

Strona 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

Strona 25

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

Strona 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

Strona 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

Strona 28

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

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

Strona 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

Strona 31 - To create a security group

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

Strona 32

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

Strona 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

Strona 34 - Resources on Amazon EC2

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

Strona 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

Strona 36 - Create your Application

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

Strona 37 - For example:

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

Strona 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

Strona 39 - Prerequisites

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

Strona 40

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

Strona 41

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

Strona 42

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

Strona 43

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

Strona 44

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

Strona 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

Strona 46

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

Strona 47

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

Strona 48 - Management

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

Strona 49

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

Strona 50

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

Strona 51

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

Strona 52

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

Strona 53

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

Strona 54

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

Strona 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

Strona 56

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

Strona 57

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

Strona 58 - Termination

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

Strona 59

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

Strona 60

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

Strona 61

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

Strona 62

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

Strona 63

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

Strona 64

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

Strona 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

Strona 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

Strona 67

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

Strona 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

Strona 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

Strona 70 - Additional Resources

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

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

Komentarze do niniejszej Instrukcji

Brak uwag