Amazon AWS SDK Betriebsanweisung

Stöbern Sie online oder laden Sie Betriebsanweisung nach Software Amazon AWS SDK herunter. Amazon AWS SDK User guide Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 73
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 0
AWS SDK for .NET
Developer Guide
Version v2.0.0
Seitenansicht 0
1 2 3 4 5 6 ... 72 73

Inhaltsverzeichnis

Seite 1 - AWS SDK for .NET

AWS SDK for .NETDeveloper GuideVersion v2.0.0

Seite 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

Seite 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

Seite 4

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

Seite 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

Seite 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

Seite 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

Seite 8 - Install the AWS SDK for .NET

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

Seite 9 - Start a New Project

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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 16 - Using Proxy Credentials

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

Seite 17

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

Seite 18

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

Seite 19

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

Seite 20 - AWS Region Selection

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

Seite 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

Seite 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

Seite 23 - Callback with Client

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

Seite 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

Seite 25 - Complete Sample

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

Seite 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

Seite 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

Seite 28

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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 34 - NuGet Package Manager Console

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

Seite 35 - Version v2.0.0

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

Seite 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

Seite 37

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

Seite 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

Seite 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

Seite 40

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

Seite 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

Seite 42 - Creating a Security Group

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

Seite 43

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

Seite 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

Seite 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

Seite 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

Seite 47

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

Seite 48

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

Seite 49

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

Seite 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

Seite 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

Seite 52

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

Seite 53 - Create an IAM Role

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

Seite 54

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

Seite 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

Seite 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

Seite 57

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

Seite 58

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

Seite 59

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

Seite 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

Seite 61

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

Seite 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

Seite 63 - Create an Amazon SQS Queue

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

Seite 64 - Send an Amazon SQS Message

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

Seite 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

Seite 66

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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Kommentare zu diesen Handbüchern

Keine Kommentare