AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 4.5
 
Implementation for accessing S3

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonServiceClient
    Amazon.S3.AmazonS3Client

Namespace: Amazon.S3
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public class AmazonS3Client : AmazonServiceClient
         IAmazonS3, IDisposable

The AmazonS3Client type exposes the following members

Constructors

NameDescription
Public Method AmazonS3Client() Constructs AmazonS3Client with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             
Public Method AmazonS3Client(RegionEndpoint) Constructs AmazonS3Client with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             
Public Method AmazonS3Client(AmazonS3Config) Constructs AmazonS3Client with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             
Public Method AmazonS3Client(AWSCredentials) Constructs AmazonS3Client with AWS Credentials
Public Method AmazonS3Client(AWSCredentials, RegionEndpoint) Constructs AmazonS3Client with AWS Credentials
Public Method AmazonS3Client(AWSCredentials, AmazonS3Config) Constructs AmazonS3Client with AWS Credentials and an AmazonS3Client Configuration object.
Public Method AmazonS3Client(string, string) Constructs AmazonS3Client with AWS Access Key ID and AWS Secret Key
Public Method AmazonS3Client(string, string, RegionEndpoint) Constructs AmazonS3Client with AWS Access Key ID and AWS Secret Key
Public Method AmazonS3Client(string, string, AmazonS3Config) Constructs AmazonS3Client with AWS Access Key ID, AWS Secret Key and an AmazonS3Client Configuration object.
Public Method AmazonS3Client(string, string, string) Constructs AmazonS3Client with AWS Access Key ID and AWS Secret Key
Public Method AmazonS3Client(string, string, string, RegionEndpoint) Constructs AmazonS3Client with AWS Access Key ID and AWS Secret Key
Public Method AmazonS3Client(string, string, string, AmazonS3Config) Constructs AmazonS3Client with AWS Access Key ID, AWS Secret Key and an AmazonS3Client Configuration object.

Methods

NameDescription
Public Method AbortMultipartUpload(string, string, string) Aborts a multipart upload.

To verify that all parts have been removed, so you don't get charged for the part storage, you should call the List Parts operation and ensure the parts list is empty.

Public Method AbortMultipartUpload(AbortMultipartUploadRequest) Aborts a multipart upload.

To verify that all parts have been removed, so you don't get charged for the part storage, you should call the List Parts operation and ensure the parts list is empty.

Public Method AbortMultipartUploadAsync(AbortMultipartUploadRequest, CancellationToken) Initiates the asynchronous execution of the AbortMultipartUpload operation.
Public Method CompleteMultipartUpload(CompleteMultipartUploadRequest) Completes a multipart upload by assembling previously uploaded parts.
Public Method CompleteMultipartUploadAsync(CompleteMultipartUploadRequest, CancellationToken) Initiates the asynchronous execution of the CompleteMultipartUpload operation.
Public Method CopyObject(string, string, string, string) Creates a copy of an object that is already stored in Amazon S3.
Public Method CopyObject(string, string, string, string, string) Creates a copy of an object that is already stored in Amazon S3.
Public Method CopyObject(CopyObjectRequest) Creates a copy of an object that is already stored in Amazon S3.
Public Method CopyObjectAsync(CopyObjectRequest, CancellationToken) Initiates the asynchronous execution of the CopyObject operation.
Public Method CopyPart(string, string, string, string, string) Uploads a part by copying data from an existing object as data source.
Public Method CopyPart(string, string, string, string, string, string) Uploads a part by copying data from an existing object as data source.
Public Method CopyPart(CopyPartRequest) Uploads a part by copying data from an existing object as data source.
Public Method CopyPartAsync(CopyPartRequest, CancellationToken) Initiates the asynchronous execution of the CopyPart operation.
Public Method DeleteBucket(string) Deletes the bucket. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.
Public Method DeleteBucket(DeleteBucketRequest) Deletes the bucket. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.
Public Method DeleteBucketAsync(DeleteBucketRequest, CancellationToken) Initiates the asynchronous execution of the DeleteBucket operation.
Public Method DeleteBucketPolicy(string) Deletes the policy from the bucket.
Public Method DeleteBucketPolicy(DeleteBucketPolicyRequest) Deletes the policy from the bucket.
Public Method DeleteBucketPolicyAsync(DeleteBucketPolicyRequest, CancellationToken) Initiates the asynchronous execution of the DeleteBucketPolicy operation.
Public Method DeleteBucketReplication(DeleteBucketReplicationRequest) Deletes the replication configuration for the given Amazon S3 bucket.
Public Method DeleteBucketReplicationAsync(DeleteBucketReplicationRequest, CancellationToken) Initiates the asynchronous execution of the DeleteBucketReplication operation.
Public Method DeleteBucketTagging(string) Deletes the tags from the bucket.
Public Method DeleteBucketTagging(DeleteBucketTaggingRequest) Deletes the tags from the bucket.
Public Method DeleteBucketTaggingAsync(DeleteBucketTaggingRequest, CancellationToken) Initiates the asynchronous execution of the DeleteBucketTagging operation.
Public Method DeleteBucketWebsite(string) This operation removes the website configuration from the bucket.
Public Method DeleteBucketWebsite(DeleteBucketWebsiteRequest) This operation removes the website configuration from the bucket.
Public Method DeleteBucketWebsiteAsync(DeleteBucketWebsiteRequest, CancellationToken) Initiates the asynchronous execution of the DeleteBucketWebsite operation.
Public Method DeleteCORSConfiguration(string) Deletes the cors configuration information set for the bucket.
Public Method DeleteCORSConfiguration(DeleteCORSConfigurationRequest) Deletes the cors configuration information set for the bucket.
Public Method DeleteCORSConfigurationAsync(DeleteCORSConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the DeleteCORSConfiguration operation.
Public Method DeleteLifecycleConfiguration(string) Deletes the lifecycle configuration from the bucket.
Public Method DeleteLifecycleConfiguration(DeleteLifecycleConfigurationRequest) Deletes the lifecycle configuration from the bucket.
Public Method DeleteLifecycleConfigurationAsync(DeleteLifecycleConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the DeleteLifecycleConfiguration operation.
Public Method DeleteObject(string, string) Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects.
Public Method DeleteObject(string, string, string) Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects.
Public Method DeleteObject(DeleteObjectRequest) Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects.
Public Method DeleteObjectAsync(DeleteObjectRequest, CancellationToken) Initiates the asynchronous execution of the DeleteObject operation.
Public Method DeleteObjects(DeleteObjectsRequest) This operation enables you to delete multiple objects from a bucket using a single HTTP request. You may specify up to 1000 keys.
Public Method DeleteObjectsAsync(DeleteObjectsRequest, CancellationToken) Initiates the asynchronous execution of the DeleteObjects operation.
Public Method Dispose() Inherited from Amazon.Runtime.AmazonServiceClient.
Public Method GetACL(string) Gets the access control policy for the bucket.
Public Method GetACL(GetACLRequest) Gets the access control policy for the bucket.
Public Method GetACLAsync(GetACLRequest, CancellationToken) Initiates the asynchronous execution of the GetACL operation.
Public Method GetBucketLocation(string) Returns the region the bucket resides in.
Public Method GetBucketLocation(GetBucketLocationRequest) Returns the region the bucket resides in.
Public Method GetBucketLocationAsync(GetBucketLocationRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketLocation operation.
Public Method GetBucketLogging(string) Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the bucket owner.
Public Method GetBucketLogging(GetBucketLoggingRequest) Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the bucket owner.
Public Method GetBucketLoggingAsync(GetBucketLoggingRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketLogging operation.
Public Method GetBucketNotification(string) Returns the notification configuration of a bucket.
Public Method GetBucketNotification(GetBucketNotificationRequest) Returns the notification configuration of a bucket.
Public Method GetBucketNotificationAsync(GetBucketNotificationRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketNotification operation.
Public Method GetBucketPolicy(string) Returns the policy of a specified bucket.
Public Method GetBucketPolicy(GetBucketPolicyRequest) Returns the policy of a specified bucket.
Public Method GetBucketPolicyAsync(GetBucketPolicyRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketPolicy operation.
Public Method GetBucketReplication(GetBucketReplicationRequest) Retrieves the replication configuration for the given Amazon S3 bucket.
Public Method GetBucketReplicationAsync(GetBucketReplicationRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketReplication operation.
Public Method GetBucketRequestPayment(string) Returns the request payment configuration of a bucket.
Public Method GetBucketRequestPayment(GetBucketRequestPaymentRequest) Returns the request payment configuration of a bucket.
Public Method GetBucketRequestPaymentAsync(GetBucketRequestPaymentRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketRequestPayment operation.
Public Method GetBucketTagging(GetBucketTaggingRequest) Returns the tag set associated with the bucket.
Public Method GetBucketTaggingAsync(GetBucketTaggingRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketTagging operation.
Public Method GetBucketVersioning(string) Returns the versioning state of a bucket.
Public Method GetBucketVersioning(GetBucketVersioningRequest) Returns the versioning state of a bucket.
Public Method GetBucketVersioningAsync(GetBucketVersioningRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketVersioning operation.
Public Method GetBucketWebsite(string) Returns the website configuration for a bucket.
Public Method GetBucketWebsite(GetBucketWebsiteRequest) Returns the website configuration for a bucket.
Public Method GetBucketWebsiteAsync(GetBucketWebsiteRequest, CancellationToken) Initiates the asynchronous execution of the GetBucketWebsite operation.
Public Method GetCORSConfiguration(string) Returns the cors configuration for the bucket.
Public Method GetCORSConfiguration(GetCORSConfigurationRequest) Returns the cors configuration for the bucket.
Public Method GetCORSConfigurationAsync(GetCORSConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the GetCORSConfiguration operation.
Public Method GetLifecycleConfiguration(string) Returns the lifecycle configuration information set on the bucket.
Public Method GetLifecycleConfiguration(GetLifecycleConfigurationRequest) Returns the lifecycle configuration information set on the bucket.
Public Method GetLifecycleConfigurationAsync(GetLifecycleConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the GetLifecycleConfiguration operation.
Public Method GetObject(string, string) Retrieves objects from Amazon S3.
Public Method GetObject(string, string, string) Retrieves objects from Amazon S3.
Public Method GetObject(GetObjectRequest) Retrieves objects from Amazon S3.
Public Method GetObjectAsync(GetObjectRequest, CancellationToken) Initiates the asynchronous execution of the GetObject operation.
Public Method GetObjectMetadata(string, string) The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object.
Public Method GetObjectMetadata(string, string, string) The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object.
Public Method GetObjectMetadata(GetObjectMetadataRequest) The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object.
Public Method GetObjectMetadataAsync(GetObjectMetadataRequest, CancellationToken) Initiates the asynchronous execution of the GetObjectMetadata operation.
Public Method GetObjectTorrent(string, string) Return torrent files from a bucket.
Public Method GetObjectTorrent(GetObjectTorrentRequest) Return torrent files from a bucket.
Public Method GetObjectTorrentAsync(GetObjectTorrentRequest, CancellationToken) Initiates the asynchronous execution of the GetObjectTorrent operation.
Public Method GetPreSignedURL(GetPreSignedUrlRequest) Create a signed URL allowing access to a resource that would usually require authentication.
Public Method InitiateMultipartUpload(string, string) Initiates a multipart upload and returns an upload ID.

Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.

Public Method InitiateMultipartUpload(InitiateMultipartUploadRequest) Initiates a multipart upload and returns an upload ID.

Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.

Public Method InitiateMultipartUploadAsync(InitiateMultipartUploadRequest, CancellationToken) Initiates the asynchronous execution of the InitiateMultipartUpload operation.
Public Method ListBuckets() Returns a list of all buckets owned by the authenticated sender of the request.
Public Method ListBuckets(ListBucketsRequest) Returns a list of all buckets owned by the authenticated sender of the request.
Public Method ListBucketsAsync(ListBucketsRequest, CancellationToken) Initiates the asynchronous execution of the ListBuckets operation.
Public Method ListMultipartUploads(string) This operation lists in-progress multipart uploads.
Public Method ListMultipartUploads(string, string) This operation lists in-progress multipart uploads.
Public Method ListMultipartUploads(ListMultipartUploadsRequest) This operation lists in-progress multipart uploads.
Public Method ListMultipartUploadsAsync(ListMultipartUploadsRequest, CancellationToken) Initiates the asynchronous execution of the ListMultipartUploads operation.
Public Method ListObjects(string) Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
Public Method ListObjects(string, string) Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
Public Method ListObjects(ListObjectsRequest) Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
Public Method ListObjectsAsync(ListObjectsRequest, CancellationToken) Initiates the asynchronous execution of the ListObjects operation.
Public Method ListParts(string, string, string) Lists the parts that have been uploaded for a specific multipart upload.
Public Method ListParts(ListPartsRequest) Lists the parts that have been uploaded for a specific multipart upload.
Public Method ListPartsAsync(ListPartsRequest, CancellationToken) Initiates the asynchronous execution of the ListParts operation.
Public Method ListVersions(string) Returns metadata about all of the versions of objects in a bucket.
Public Method ListVersions(string, string) Returns metadata about all of the versions of objects in a bucket.
Public Method ListVersions(ListVersionsRequest) Returns metadata about all of the versions of objects in a bucket.
Public Method ListVersionsAsync(ListVersionsRequest, CancellationToken) Initiates the asynchronous execution of the ListVersions operation.
Public Method PutACL(PutACLRequest) Sets the permissions on a bucket using access control lists (ACL).
Public Method PutACLAsync(PutACLRequest, CancellationToken) Initiates the asynchronous execution of the PutACL operation.
Public Method PutBucket(string) Creates a new bucket.
Public Method PutBucket(PutBucketRequest) Creates a new bucket.
Public Method PutBucketAsync(PutBucketRequest, CancellationToken) Initiates the asynchronous execution of the PutBucket operation.
Public Method PutBucketLogging(PutBucketLoggingRequest) Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters. To set the logging status of a bucket, you must be the bucket owner.
Public Method PutBucketLoggingAsync(PutBucketLoggingRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketLogging operation.
Public Method PutBucketNotification(PutBucketNotificationRequest) Enables notifications of specified events for a bucket.
Public Method PutBucketNotificationAsync(PutBucketNotificationRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketNotification operation.
Public Method PutBucketPolicy(string, string) Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.
Public Method PutBucketPolicy(string, string, string) Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.
Public Method PutBucketPolicy(PutBucketPolicyRequest) Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.
Public Method PutBucketPolicyAsync(PutBucketPolicyRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketPolicy operation.
Public Method PutBucketReplication(PutBucketReplicationRequest) Creates a new replication configuration (or replaces an existing one, if present).
Public Method PutBucketReplicationAsync(PutBucketReplicationRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketReplication operation.
Public Method PutBucketRequestPayment(string, RequestPaymentConfiguration) Sets the request payment configuration for a bucket. By default, the bucket owner pays for downloads from the bucket. This configuration parameter enables the bucket owner (only) to specify that the person requesting the download will be charged for the download. Documentation on requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html
Public Method PutBucketRequestPayment(PutBucketRequestPaymentRequest) Sets the request payment configuration for a bucket. By default, the bucket owner pays for downloads from the bucket. This configuration parameter enables the bucket owner (only) to specify that the person requesting the download will be charged for the download. Documentation on requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html
Public Method PutBucketRequestPaymentAsync(PutBucketRequestPaymentRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketRequestPayment operation.
Public Method PutBucketTagging(string, List<Tag>) Sets the tags for a bucket.
Public Method PutBucketTagging(PutBucketTaggingRequest) Sets the tags for a bucket.
Public Method PutBucketTaggingAsync(PutBucketTaggingRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketTagging operation.
Public Method PutBucketVersioning(PutBucketVersioningRequest) Sets the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.
Public Method PutBucketVersioningAsync(PutBucketVersioningRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketVersioning operation.
Public Method PutBucketWebsite(string, WebsiteConfiguration) Set the website configuration for a bucket.
Public Method PutBucketWebsite(PutBucketWebsiteRequest) Set the website configuration for a bucket.
Public Method PutBucketWebsiteAsync(PutBucketWebsiteRequest, CancellationToken) Initiates the asynchronous execution of the PutBucketWebsite operation.
Public Method PutCORSConfiguration(string, CORSConfiguration) Sets the cors configuration for a bucket.
Public Method PutCORSConfiguration(PutCORSConfigurationRequest) Sets the cors configuration for a bucket.
Public Method PutCORSConfigurationAsync(PutCORSConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the PutCORSConfiguration operation.
Public Method PutLifecycleConfiguration(string, LifecycleConfiguration) Sets lifecycle configuration for your bucket. If a lifecycle configuration exists, it replaces it.
Public Method PutLifecycleConfiguration(PutLifecycleConfigurationRequest) Sets lifecycle configuration for your bucket. If a lifecycle configuration exists, it replaces it.
Public Method PutLifecycleConfigurationAsync(PutLifecycleConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the PutLifecycleConfiguration operation.
Public Method PutObject(PutObjectRequest) Adds an object to a bucket.
Public Method PutObjectAsync(PutObjectRequest, CancellationToken) Initiates the asynchronous execution of the PutObject operation.
Public Method RestoreObject(string, string) Restores an archived copy of an object back into Amazon S3
Public Method RestoreObject(string, string, int) Restores an archived copy of an object back into Amazon S3
Public Method RestoreObject(string, string, string) Restores an archived copy of an object back into Amazon S3
Public Method RestoreObject(string, string, string, int) Restores an archived copy of an object back into Amazon S3
Public Method RestoreObject(RestoreObjectRequest) Restores an archived copy of an object back into Amazon S3
Public Method RestoreObjectAsync(RestoreObjectRequest, CancellationToken) Initiates the asynchronous execution of the RestoreObject operation.
Public Method UploadPart(UploadPartRequest) Uploads a part in a multipart upload.

Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.

Public Method UploadPartAsync(UploadPartRequest, CancellationToken) Initiates the asynchronous execution of the UploadPart operation.

Events

NameDescription
Event AfterResponseEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event BeforeRequestEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event ExceptionEvent Inherited from Amazon.Runtime.AmazonServiceClient.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8