Sampat Patil
Sampat Patil

Reputation: 13

Listing a bucket’s content

ListObjectsRequest request = new ListObjectsRequest();

ListObjectsResponse response = client.ListObjects(request);
foreach (S3Object o in response.S3Objects)
{
        Console.WriteLine(o.BucketName);
}

From above code I'm getting Access denied status code(403 forbidden) I want to show all buckets irrespective of access rights. How can it be handled ?

Example: In Amazon there are 10 buckets, out of which 2 buckets are not accessible for my credentials. So how to get at-least those 8 buckets which are accessible?

Upvotes: 1

Views: 73

Answers (1)

Deepak Singhal
Deepak Singhal

Reputation: 10876

Your IAM User/Policy/Role need atleast "list" permissions on s3 along with permissions on individual bucket.

If you do not have "list" permissions; then u need to directly access the bucket.

Upvotes: 1

Related Questions