Amazon AWS SDK Guide de l'utilisateur

Naviguer en ligne ou télécharger Guide de l'utilisateur pour Logiciel Amazon AWS SDK. Amazon AWS SDK User guide Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 71
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 0
AWS SDK for .NET
Developer Guide
Version v2.0.0
Vue de la page 0
1 2 3 4 5 6 ... 70 71

Résumé du contenu

Page 1 - AWS SDK for .NET

AWS SDK for .NETDeveloper GuideVersion v2.0.0

Page 2

To create a new AWS Management Console project1. In Visual Studio, on the File menu, select New, and then click Project to open the New Projectdialog

Page 3 - Table of Contents

</appSettings></configuration>The Toolkit for Visual Studio adds two key-value pairs to appSettings, based on the values youspecified

Page 4 - Version v2.0.0

Programming with the AWS SDKfor .NETThis section provides general programming techniques and information for developing software with theAWS SDK for .

Page 5 - AWS SDK for .NET Developer

You can also configure an SDK for .NET application programmatically, by setting property values in theAWSConfigs class. The following example specifie

Page 6 - About Amazon Web Services

Topics• Using the SDK Store (p. 10)• Using a Credentials File (p. 10)• Using Credentials in an Application (p. 11)Using the SDK StoreThe preferred way

Page 7 - AWS Account and Credentials

[profile_name]aws_access_key_id = accessKeyaws_secret_access_key = secretKeyA profile can optionally include a session token. For more information, se

Page 8 - .NET Development Environment

<configuration> <appSettings> <add key="AWSProfileName" value="development"/> </appSettings></conf

Page 9 - Starting a New Project

AmazonS3Config config = new AmazonS3Config();config.ProxyCredentials = new NetworkCredential("foo", "bar");Earlier versions of the

Page 10

You can set multiple values at once, separated by commas. To set both log4net andSystem.Diagnostics logging in the .config file, use:<add key="

Page 11

To set service logging with the SDK for .NET API, set the AWSConfigs.ResponseLogging propertyto one of the values of the ResponseLoggingOption enumera

Page 12 - Programming with the AWS SDK

AWS SDK for .NET: Developer GuideCopyright © 2014 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.All trademarks not owned by Ama

Page 13 - Configuring AWS Credentials

By default, this setting is false, though Signature Version 4 may be used by default in some casesor with some regions. When the setting is true, Sign

Page 14 - Using a Credentials File

Asynchronous API for .NET 4.5, Windows Store,and Windows Phone 8The AWS SDK for .NET uses the new task-based asynchronous pattern for .NET 4.5, Window

Page 15 - Specifying a Profile

void Callback(IAsyncResult asyncResult)Object stateThe third parameter, state, is a user-defined object that is made available to the callback functio

Page 16 - Using Proxy Credentials

No Callback SpecifiedThe following example code calls BeginPutObject, performs some work, then calls EndPutObject toretrieve the service response.The

Page 17

}}The following line of code calls BeginPutObject and specifies the preceding callback function.Whenthe PutObject operation completes, the callback

Page 18

called. The callback function uses the Amazon S3 client object to call the EndPutObject method toretrieve the server response.The callback also extrac

Page 19

{ Console.WriteLine("Finished PutObject operation with simple callback"); Console.Write("\n\n"); }

Page 20 - AWS Region Selection

// Create a PutObject request // // You will need to change the BucketName below in order to run this // sample code.

Page 21 - Asynchronous API for .NET 3.5

See Also• Getting Started (p. 3)• Programming with the AWS SDK for .NET (p. 8)Migrating Your Code to the Latest Version of theAWS SDK for .NETThis gui

Page 22 - Examples

• The version 2 runtime for .NET 3.5 is similar to the existing version 1 runtime, which is based on theSystem.Net.HttpWebRequest class and uses the B

Page 23 - Callback with Client

Table of ContentsAWS SDK for .NET Developer Guide ... 1Ho

Page 24 - Callback with State Object

• All client interfaces have been renamed to follow the .NET convention of starting with the letter "I". Forexample, the AmazonEC2 class is

Page 25 - Complete Sample

• The GenerateMD5 property has been removed from PutObjectRequest and UploadPartRequestbecause this is now automatically computed as the object is bei

Page 26

Refer to the return value type of the Create* method for the service client that you're using to see whatvalues are returned. These are all liste

Page 27

This version of the SDK for .NET supports only the following services.This is the same set of servicesas those supported in the AWS SDK for Android an

Page 28

From the Manage NuGet Packages dialog box, select Online in the left pane.You can then search forthe package that you want to install using the search

Page 29 - Breaking Changes

AWS SDK for .NET Tutorials andExamplesThis chapter provides tutorials, walkthroughs, and examples of programming Amazon Web Services withthe AWS SDK f

Page 30 - Amazon S3

numbers of instances. It also doesn't work well for instances that are created by AWS on behalf of thecustomer, such as Spot Instances or instanc

Page 31 - Response and Result Classes

Walkthrough: Using IAM Roles to Retrieve anAmazon S3 Object from an Amazon EC2 InstanceIn this walkthrough, we consider a program that retrieves an ob

Page 32 - AWS SDK for Windows Phone 8

} FileStream s = new FileStream( "s3Object.txt", FileMode.Create ); StreamWriter writer = new StreamWriter( s );

Page 33 - NuGet from Solution Explorer

3. Edit the Source File to Remove the Credentials4. Transfer the Compiled Program to Your Amazon EC2 Instance5. Run the ProgramCreate the RoleThe firs

Page 34 - NuGet Package Manager Console

Conclusion ... 60Creating and Using an A

Page 35

your Amazon EC2 instance. When you create the Amazon EC2 instance, specify the IAM role that youcreated previously in the IAM console.When you create

Page 36 - Manage Your Credentials

using (GetObjectResponse response = client.GetObject(request)) { using (Stream responseStream = response.ResponseStream) {

Page 37

You should configure your Remote Desktop session so that you can access your local drives from theAmazon EC2 instance. If you use the shortcut provide

Page 38 - Instances

Run the ProgramRun the program. Ensure that the AWS assembly is either in the same directory as the program or thatyou have installed it in the Genera

Page 39 - Create the Role

Create the ASP.NET_SessionState TableWhen your application starts, it looks for an Amazon DynamoDB table named, by default,ASP.NET_SessionState. We re

Page 40

Configure the Session State ProviderTo configure an ASP.NET application to use DynamoDB as the session state server1. Add references to both AWSSDK.dl

Page 41

RegionRequired string attribute.The AWS region in which to use Amazon DynamoDB. For a list of availableAWS regions, go to the Regions and Endpoints do

Page 42

Tutorial: Creating Amazon EC2 Instances withthe AWS SDK for .NETThis topic demonstrates how to use the AWS SDK for .NET to create, start, and terminat

Page 43 - DynamoDB

var ec2Client = new AmazonEC2Client(RegionEndpoint.USEast1);The client object's permissions are determined by the policy that is attached to the

Page 44

To enumerate existing security groups1. Obtain a list of your account's security groups.DescribeSecurityGroupsRequest secGroupRequest = new Des

Page 45 - Web.config Options

AWS SDK for .NET DeveloperGuideThe AWS SDK for .NET is a single downloadable package that includes Visual Studio project templates,the AWS .NET librar

Page 46 - Security Considerations

CreateSecurityGroupResponse newGroupResponse = ec2Client.CreateSecurityGroup(newGroupRequest);Pass the request object to the Amazon EC2 client'

Page 47 - Create an Amazon EC2 Client

• Set the GroupName property to the security group name of.• Add the IpPermissionSpecification object from Step 1 to the group's IpPermissions co

Page 48 - Important

DescribeKeyPairsRequest keyPairDescriptionRequest = new DescribeKeyPairsRequest();DescribeKeyPairsResponse keyPairDescriptionResponse = ec2Client.

Page 49

var runInstancesRequest = new RunInstancesRequest(){ ImageId = "ami-62c44d52", InstanceType = "m1.small", MinCount = 1, MaxCou

Page 50

RunInstancesResponse runResponse = ec2Client.RunInstances(runInstances Request);3. You can use the returned RunInstancesResponse object to get a list

Page 51

The DescribeInstancesResponse object's DescribeInstancesResult.Reservations propertycontains a list of reservations. In this case, there is only

Page 52 - Launch Amazon EC2 Instances

DescriptionResourceSample code, documentation, tools, and additional resourcesto help you build applications on Amazon Web Services.Windows & .NET

Page 53

PrerequisitesThis tutorial assumes that you have signed up for AWS, set up your .NET development environment, andinstalled the AWS SDK for .NET. If yo

Page 54 - To check EC2 status

10 } catch (AmazonEC2Exception ae) { if (string.Equals(ae.ErrorCode, "InvalidGroup.Duplicate", StringCompar ison.InvariantCult

Page 55 - To terminate EC2 instances

throw; 15 } }You can also create the security group using the AWS Toolkit for Visual Studio. Go to the toolkitdocumentation for mor

Page 56 - Overview

Programming with the AWS SDK for .NET (p. 8)The basics of how to implement applications with the SDK for .NET that applies to all AWS services.This ch

Page 57 - Prerequisites

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 Ins

Page 58

be fulfilled.You can determine the types of available instances and the On-Demand prices for instancesby going to Amazon EC2 Pricing page.To request a

Page 59

SpotInstancesResult.SpotInstanceRequest) { describeRequest.SpotInstanceRequestId.Add(spotInstanceRequest.SpotIn stanceRequestId); 10 } 1 /

Page 60

Console.WriteLine(e.Message); } 50 if (anyOpen) { // Wait for the requests to go active.

Page 61

To terminate any outstanding instances, we use the instanceIds array, which we populated with theinstance IDs of those instances that transitioned to

Page 62

Create an Amazon SQS ClientYou will need an Amazon SQS client in order to create and use an Amazon SQS queue. Before configuringyour client, you shoul

Page 63

To create an Amazon SQS queue1. Create and initialize a CreateQueueRequest instance. Provide the name of your queue and specifya visibility timeout f

Page 64 - Conclusion

ImportantDue to the distributed nature of the queue, Amazon SQS cannot guarantee you will receivemessages in the exact order they are sent. If you req

Page 65 - Create an Amazon SQS Queue

ReceiveMessageResponse receiveMessageResponse = amazonSQSClient.ReceiveMessage(receiveMessageRequest);The method returns a ReceiveMessageResponse

Page 66 - Send an Amazon SQS Message

DeleteMessageResponse response = amazonSQSClient.DeleteMessage(deleteMessageRequest);Calling DeleteMessage unconditionally removes the message fro

Page 67

Getting Started with the AWS SDKfor .NETTo get started with the AWS SDK for .NET, set up the following:• AWS Account and Credentials• .NET Development

Page 68

Additional ResourcesHome Page for AWS SDK for .NETFor more information about the AWS SDK for .NET, go to the home page for the SDK athttp://amazonaws.

Page 69 - Related Resources

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

Page 70 - Additional Resources

inserted at build time. This approach ensures that your credentials are not unintentionally exposed withyour project on a public site. For more inform

Page 71 - Document History

To install the SDK for .NET1. Go to http://amazonaws.cn/sdkfornet.2. Click the Download button in the upper right corner of the page.Your browser will

Commentaires sur ces manuels

Pas de commentaire