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
    / 71
  • 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 ... 70 71

Inhaltsverzeichnis

Seite 1 - AWS SDK for .NET

AWS SDK for .NETDeveloper GuideVersion v2.0.0

Seite 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

Seite 3 - Table of Contents

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

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

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

Seite 8 - .NET Development Environment

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

Seite 9 - Starting 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 andSystem.Diagnostics logging in the .config file, use:<add key="

Seite 11

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.All trademarks not owned by Ama

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

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

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 UploadPartRequestbecause this 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

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

Seite 29 - Breaking Changes

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

Seite 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

Seite 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

Seite 32 - AWS SDK for Windows Phone 8

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

Seite 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

Seite 34 - NuGet Package Manager Console

Conclusion ... 60Creating and Using an A

Seite 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

Seite 36 - Manage Your Credentials

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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 43 - DynamoDB

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

Seite 44

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

Seite 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

Seite 46 - Security Considerations

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

Seite 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

Seite 48 - Important

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

Seite 49

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

Seite 50

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

Seite 51

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

Seite 52 - Launch Amazon EC2 Instances

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

Seite 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

Seite 54 - To check EC2 status

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

Seite 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

Seite 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

Seite 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

Seite 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

Seite 59

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

Seite 60

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

Seite 61

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

Seite 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

Seite 63

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

Seite 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

Seite 65 - Create an Amazon SQS Queue

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

Seite 66 - Send an Amazon SQS Message

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

Seite 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

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

Seite 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

Seite 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

Seite 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

Kommentare zu diesen Handbüchern

Keine Kommentare