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
    / 73
  • 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 ... 72 73

Résumé du contenu

Page 1 - AWS SDK for .NET

AWS SDK for .NETDeveloper GuideVersion v2.0.0

Page 2

3. Use the AWS Access Credentials dialog box to configure your application.• Specify which account profile your code should use to access AWS.To use a

Page 3 - Table of Contents

For more information about configuring an AWS application, see Configuring Your AWS SDK for .NETApplication (p. 8).Version v2.0.07AWS SDK for .NET Dev

Page 4

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 - To sign up for an AWS account

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

Page 8 - Install the AWS SDK for .NET

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

Page 9 - Start 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 and System.Dia-gnostics logging in the .config file, use:<add key=&qu

Page 11 - Application (p. 8)

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.The following are trademarks of

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

callback function uses the Amazon S3 client object to call the EndPutObject method to retrieve theserver response. The callback also extracts the star

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 UploadPartRequest becausethis 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

NuGet from Solution ExplorerTo use NuGet from Solution Explorer, right-click on your project and select Manage NuGet Packages...from the context menu.

Page 29 - Breaking Changes

Install-Package AWSSDK -Version 1.5.1.0The NuGet website provides a page for every package that is available through NuGet such as theAWSSDK and AWS.E

Page 30 - Amazon S3

AWS SDK for .NET Tutorials andExamplesThe following tutorials and examples demonstrate how to use the AWS SDK for .NET to access AmazonWeb Services.Be

Page 31 - Response and Result Classes

The AWS SDK for .NET includes AWS.SessionProvider.dll, which contains an ASP.NET sessionstate provider. Also included is the AmazonDynamoDBSessionProv

Page 32 - AWS SDK for Windows Phone 8

NoteIf you decide not to create the table beforehand, the session state provider will create the tablefor you during its initialization. See the web.c

Page 33 - Installation

AWSSecretKeySecret key to use.This can be set either in the providers section or in the appSettings section.We recommend not using this setting. Inste

Page 34 - NuGet Package Manager Console

Creating and Using an Amazon SQS Queue ... 58Create an Amazon SQS Client ...

Page 35 - Version v2.0.0

"Resource" : "arn:aws:dynamodb:us-east-1:<YOUR-AWS-ACCOUNT-ID>:table/ASP.NET_SessionState" } ]}Tutorial: Creating

Page 36

Create a Security Group Using the SDK for .NETCreate a security group, which acts as a virtual firewall that controls the network traffic for one or m

Page 37

{ Name = "vpc-id", Values = new List<string>() {vpcID}};var dsgRequest = new DescribeSecurityGroupsRequest();dsgRequest.Filters.

Page 38 - Web.config Options

The CreateSecurityGroup method returns a CreateSecurityGroupResponse object.You can get the IDof the new security group from the response and then us

Page 39 - Security Considerations

FromPort and ToPortThe beginning and end of the port range.This example specifies a single port, 3389, which isused to communicate with Windows over R

Page 40

foreach (KeyPairInfo item in myKeyPairs){ Console.WriteLine("Existing key pair: " + item.KeyName); if (item.KeyName == keyPairName)

Page 41

• Checking the State of Your Instance (p. 46)• Connecting to Your Running Instance (p. 46)Launching an EC2 InstanceYou launch an instance in either EC

Page 42 - Creating a Security Group

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ &qu

Page 43

{ DeviceIndex = 0, SubnetId = subnetID, Groups = groups, AssociatePublicIpAddress = true};List<InstanceNetworkInterfaceSpecification>

Page 44 - Enumerating Your Key Pairs

3. (Optional) To launch the instance with an IAM role (p. 47), specify an IAM instance profile in theRunInstancesRequest.Note that an IAM user can&apo

Page 45

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 - Launching an EC2 Instance

Checking the State of Your InstanceUse the following procedure to get the current state of your instance. Initially, your instance is in thepending st

Page 47

var deleteRequest = new TerminateInstancesRequest(){ InstanceIds = instanceIds};var deleteResponse = ec2Client.TerminateInstances(deleteRequest);fo

Page 48

The following walkthrough uses a sample program that retrieves an object from Amazon S3 using theAWS credentials that you've configured. Next, we

Page 49

responseBody = reader.ReadToEnd(); } } using (FileStream s = new FileStream( "s3Object.txt", FileMode.Cre

Page 50

• To launch an EC2 instance using the console, follow the directions in Launching a Windows Instancein the Amazon Elastic Compute Cloud User Guide for

Page 51

a. Click Download Remote Desktop File. When your browser prompts you to do so, save the.rdp file.When you have finished, you can click Close to dismis

Page 52

Spot Instances perform exactly like other Amazon EC2 instances while running, and like other AmazonEC2 instances, Spot Instances can be terminated whe

Page 53 - Create an IAM Role

5 CreateSecurityGroupRequest securityGroupRequest = new CreateSecurity GroupRequest(); securityGroupRequest.GroupName = "GettingStar

Page 54

Comparison.InvariantCulture)) { 10 Console.WriteLine(ae.Message); } else { throw; 15 } }You can

Page 55 - Overview

To request a Spot Instance, you simply need to build your request with the parameters we have specifiedso far. We start by creating a RequestSpotInsta

Page 56 - Prerequisites

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

describeRequest.SpotInstanceRequestId.Add(spotInstanceRequest.SpotIn stanceRequestId); 10 } 1 // Create a variable that will track whether t

Page 58

50 if (anyOpen) { // Wait for the requests to go active. Console.WriteLine("Requests still in open stat

Page 59

this array to the InstanceId member of a TerminateInstancesRequest object, then passing thatobject to the ec2.TerminateInstances API. 1 if (insta

Page 60

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 61

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

Page 62 - 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 63 - Create an Amazon SQS Queue

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

Page 64 - Send an Amazon SQS Message

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

Page 65 - Important

4. Monitor the change to verify that it is complete.The example is a simple console application that shows how to use the SDK for .NET to implement th

Page 66

ResourceRecords = new List<ResourceRecord> {new ResourceRecord { Value = "192.0.2.235"}} }; Change change1 = new Cha

Page 67 - Adding Resource Record Sets

Getting Started with the AWS SDKfor .NETTo get started with the AWS SDK for .NET, complete the following tasks:Tasks• Create an AWS Account and Creden

Page 68 - To run this example

The profile must grant permissions for the actions that you intend to use—the Amazon Route 53actions in this case. Attempts to call actions that lack

Page 69

• Action – The action to be taken for this resource record set: CREATE, DELETE, or UPSERT.For more information on these actions, see Elements. This ex

Page 70 - To create a hosted zone

Additional ResourcesHome Page for AWS SDK for .NETFor more information about the AWS SDK for .NET, go to the home page for the SDK at http://aws.amazo

Page 71 - To monitor update status

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

Page 72 - Additional Resources

The preferred approach for handling credentials is to create a profile for each set of credentials in theSDK Store.You can create and manage profiles

Page 73 - Document History

To configure the .NET CLRTo ensure the best performance of your server-based applications on systems with multiple processorsor processor cores, we re

Commentaires sur ces manuels

Pas de commentaire