|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
The AWS SDK for .NET provides the API for the Amazon S3 bucket and object operations. For object operations, in addition to providing the API to upload objects in a single operation, the SDK provides the API to upload large objects in parts (see Uploading Objects Using Multipart Upload API). The API gives you the option of using a high-level or low-level API.
The Low-level APIs correspond to the underlying Amazon S3 REST operations, including the create, update, and delete operations that apply to buckets and objects. When you upload large objects using the low-level multipart upload API (see Uploading Objects Using Multipart Upload API) it provides greater control, such as letting you pause and resume multipart uploads, vary part sizes during the upload, or to begin uploads when you do not know the size of the data in advance. If you do not have these requirements, use the high-level API for uploading objects.
For uploading objects, the SDK provides a higher level of abstraction by providing the
TransferUtility class. The high-level API is a simpler API, where
in just a few lines of code you can upload files and streams to Amazon S3. You
should use this API to upload data unless you need to control the upload as
described in the preceding Low-Level API section.
For smaller data size the
TransferUtility API uploads data in a single
operation. However, the
TransferUtility switches to using the
multipart upload API when data size reaches certain threshold. By default, it uses
multiple threads to concurrently upload the parts. If a part upload fails, the API
retries the failed part upload up to three times. However, these are configurable
When using a stream for the source of data, the
TransferUtility class will not do
When writing Amazon S3 applications using the AWS SDK for .NET, you use the
AWSSDK.dll. The following namespaces in this assembly provide
the multipart upload API:
Amazon.S3.Transfer—Provides the high-level API to upload your data in parts.
It includes the
TransferUtility class that enables you to specify
a file, directory, or stream for uploading your data. It also includes the
TransferUtilityUploadDirectoryRequest classes to
configure advanced settings such as the number of concurrent threads, part
size, object metadata, the storage class (STANDARD, REDUCED_REDUNDANCY) and
Amazon.S3—Provides the implementation for the low-level APIs.
It provides methods that correspond to the Amazon S3 REST multipart upload API (see Using the REST API for Multipart Upload).
Amazon.S3.Model—Provides the low-level API classes to create requests and process responses.
For example, it provides the
InitiateMultipartUploadResponse classes you can use
when initiating a multipart upload, and the
UploadPartResponse classes when uploading parts.
For more information about the AWS SDK for .NET API, go to AWS SDK for .NET Reference.
The easiest way to get started with the .NET code examples is to install the AWS SDK for .NET. For more information, go to http://aws.amazon.com/sdkfornet. The following tasks guide you through creating and testing the C# code samples provided in this section.
General Process of Creating .NET Code Examples
Create a new Visual Studio project using the AWS Empty Project template.
In the AWS Access Credentials dialog box, provide your AWS credentials.
Note that the AWS Empty Project template is preconfigured with
<configuration> <appSettings> <add key="AWSAccessKey" value="*** Your access key ID ***"/> <add key="AWSSecretKey" value="*** Your secret key ***"/> </appSettings> </configuration>
Replace the code in the project file,
Run the code. Verify that the object is created using the AWS Management Console. For more information about AWS Management Console, go to http://aws.amazon.com/console/.