awsマイスターシリーズ reloaded aws sdk for .net

Download AWSマイスターシリーズ Reloaded AWS SDK for .NET

Post on 10-Feb-2017

226 views

Category:

Documents

10 download

Embed Size (px)

TRANSCRIPT

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS

    AWS SDK for Java/.NETEclipse plugin,Visual Studio

    2013.12.11

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    Agenda

    AWS SDK

    AWS SDK for Java

    AWS SDK for .NET

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS SDK

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS

    AWS Management Console

    AWS

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    API

    AWS

    GUICUI

    SDK

    AWS

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS SDK

    AWSSDK

    AWS SDK for Java

    AWS SDK for .NET

    AWS SDK for Ruby

    AWS SDK for PHP

    AWS SDK for Python (boto)

    AWS SDK for node.js

    AWS SDK for Android

    AWS SDK for iOS

    ActionScript

    HTTPS

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    Put,Get

    DB

    REST

    SOAPAWS SDK

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWSIAM

    (optional:MFA)

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    EC2 RunInstances

    RebootInstances

    IPAllocateAddress

    http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/Welcome.html

    SDK

    API Identity and Access Management(IAM)

    http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/Welcome.html

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS SDK for Java

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS SDK for Java

    AWSJava SDK http://aws.amazon.com/sdkforjava/

    https://github.com/aws/aws-sdk-java

    Java6

    :1.6.8

    stax

    aspectj

    commons-codec

    commons-logging

    freemarker

    httpcomponents-client

    jackson

    java-mail

    spring

    http://aws.amazon.com/sdkforjava/https://github.com/aws/aws-sdk-java

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    SDK

    jar

    AWSIAMAccess Key, Secret Access Key)

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWS Toolkit for Eclipse

    EclipseAWS SDKAWS/EC2S3

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    Java SDK

    BasicAWSCredentials

    PropertiesCredentials

    STS(

    IAM Role

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    AWSCredentials credentials = new null;try {

    credentials = new PropertiesCredentials(Util.class.getResourceAsStream("AwsCredentials.properties"));} catch (IOException e) {

    //}//Client

    IAMIAMIAM

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    us-east

    2

    setEndpoint

    setEndpoint("ec2.ap-southeast-1.amazonaws.com")

    URL

    http://docs.amazonwebservices.com/general/latest/gr/rande.html

    setRegion

    setRegion(Region.getRegion(Regions.AP_NORTHEAST_1));

    http://docs.amazonwebservices.com/general/latest/gr/rande.html

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    SetWith

    APIsetwith

    setInstanceType() withInstanceType()

    set Javasetter

    with

    with . with

    // RunInstancesRequest req =

    new RunInstancesRequest("ami-xxxxx", 5, 5);

    req.setKeyName(yourkeyname")req.withSecurityGroupIds(yoursecgroup")

    .withMonitoring(true)

    .withInstanceType(InstanceType.M1Small);

    // ec2.runInstances(runInstancesRequest);

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    EC2

    AmazonEC2Client// EC2AmazonEC2 ec2

    = new AmazonEC2Client(credentials);// ec2.setRegion(Region.getRegion(Regions.AP_NORTHEAST_1));

    // RunInstancesRequest runInstancesRequest = new RunInstancesRequest("ami-xxxxx", 5, 5)

    .withKeyName(yourkeyname")

    .withSecurityGroupIds(yoursecgroup")

    .withMonitoring(true)

    .withInstanceType(InstanceType.M1Small);

    // ec2.runInstances(runInstancesRequest);

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    S3

    AmazonS3Client

    // S3AmazonS3 s3 = new AmazonS3Client(credentials);

    // buckets3.createBucket(mybucket");

    //PUTPutObjectResult ret = client.putObject("mybucket", "aaa.txt", file);

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    S3

    //TransferManagerAmazonS3Client client = new AmazonS3Client(cred);TransferManager manager = new TransferManager(client);

    //15MBTransferManagerConfiguration c =

    new TransferManagerConfiguration();c.setMinimumUploadPartSize(5 * 1024L * 1024L);manager.setConfiguration(configuration);

    //Upload upload =

    manager.upload(bucketName, bigfileName, target, o);while (upload.isDone() == false) {

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    SDK

    S3

    DynamoDB

    Plain Old Java Object (POJOs)DynamoDB

    Amazon SQS

    AWS SimpleWorkflowService FlowFramework

    IAM

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    IAM Role for EC2 instances

    EC2 EC2

    STS(Security Token Service)

    AWS

    ID

    3API

    IAM Role

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    IAM Role

    EC2IAM Role

    SDKAPI

    STS(AWS Security Token ServiceSDK

    AWSCredentials credentials = new BasicAWSCredentials(,ID);

    AmazonEC2 ec2 = new AmazonEC2Client(credentials);ec2.describeInstances();

    AmazonEC2 ec2 = new AmazonEC2Client();ec2.describeInstances();

    IAM Role

    IAM Role

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    MFAAPI

    APIMFA

    1. IAM

    2. IAMMFA

    3. IAM

    APIMFA

    4. AWSSecurityTokenServiceClient

    MFA

    5. API

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    IAM

    { "Version":"2012-10-17",

    "Statement":[

    { "Action":["ec2:*"],

    "Effect":"Allow",

    "Resource":["*"],

    "Condition":{

    "NumericLessThan":{"aws:MultiFactorAuthAge":"3600"}}

    }

    ]

    }

    MFA13600API

  • 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

    // AWSCredentials credentials = new BasicAWSCredentials(,);// Security Token ServiceAWSSecurityTokenServiceClient stsClient =

    new AWSSecurityTokenServiceClient(credentials);GetSessionTokenRequest stsRequest = new GetSessionTokenRequest();stsReq