AWS S3: Accessing a specific bucket with the .net SDK

257 Views Asked by At

The connection model I see in the AWS documentation for the .net SDK is: Connect to the root\site level --> Go to a bucket of your choice.

As part of the initial connection to S3, I found no option to define the bucket you wish to land in. This causes a problem with users that only have access to specific buckets, but not to the root level.

It makes sense to me that this should be supported programatically, but the CreateAmazonS3Client method does not allow configuring a landing bucket. Does really any user who wants to access a specific S3 bucket using the .net SDK need to have root-level permissions?

1

There are 1 best solutions below

1
On

Does really any user who wants to access a specific S3 bucket using the .net SDK need to have root-level permissions?

No. IAM permissions can be used to restrict which buckets a user has access to.

http://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html

As part of the initial connection to S3, I found no option to define the bucket you wish to land in.

S3 is not an FTP/etc. With the SDK you do not maintain an open connection. Each request you make returns a response from the AWS API.

Checkout the API documentation for the .NET sdk http://docs.aws.amazon.com/sdkfornet/latest/apidocs/Index.html

ListBuckets() // Lists all of the buckets owned by the authenticated user
ListObjects(String bucketname) // Lists the contents of a bucket