“S3: Amazon Simple Storage Service (Amazon S3) is storage for the internet. You can use Amazon S3 to store and retrieve any amount of data at any time, from anywhere on the web.”
“S3 Glacier: Low-cost storage service that provides highly secure, durable, and flexible storage for data archiving and online backup.”
The following are the interface definitions for a facade I built using the AWS SDK for .NET. For me it made sense to create two responsibilities IBucketService to manage the bucket itself and IBucketObjectService to manage the content in the bucket.
Creates the given bucket, note that buckets are globally unique in name.
Will throw if the bucket already exists:
Amazon.S3.AmazonS3Exception : Your previous request to create the named bucket succeeded and you already own it.
Amazon.S3.AmazonS3Exception : The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
bucketName- Globally unique bucket name
Task<PutBucketResponse> PutBucketAsync(string bucketName);
Gets a list of buckets for the authenticated user
aws s3 ls
Deletes the given bucket, will throw if its not empty.
Amazon.S3.AmazonS3Exception : The bucket you tried to delete is not empty
Task<DeleteBucketResponse> DeleteBucketAsync(string bucketName);
Create a signed URL allowing access to a resource that would usually require authentication.
expireInHourshours in the future in which the URL will expire
string GetPreSignedURL(string bucketName, string key, double expireInHours);
Put the plaintext object in the S3 bucket. The content type will be set to ‘text/plain’.
Task<PutObjectResponse> PutTextObjectAsync(string bucketName, string key, string contentBody);
Get the value of the object on the bucket by reading
Task<GetObjectResponse> GetObjectAsync(string bucketName, string key);
Retrieves metadata from an object without returning the object itself.
I think this is used as HTTP header data.
Task<GetObjectMetadataResponse> GetObjectMetadataAsync(string bucketName, string key);
Deletes the given object (key).
Task<DeleteObjectResponse> DeleteObjectAsync(string bucketName, string key);
Gets the tags as
Task<GetObjectTaggingResponse> GetObjectTaggingAsync(string bucketName, string key);
Gets data about the objects as
.Key is the filename
Task<ListObjectsResponse> ListObjectsAsync(string bucketName);