1

I am trying to access bucket of Amazon S3 using VB.Net code. Like,

Dim config As AmazonS3Config = New AmazonS3Config config.ServiceURL = "https://s3-us-west-2.s3-website-us-west-2.amazonaws.com/scrape-pool/daily" client = Amazon.AWSClientFactory.CreateAmazonS3Client(access_key, secret_access_key, config) client = Amazon.AWSClientFactory.CreateAmazonS3Client Dim request As New PutObjectRequest() Dim S3_KEY As String = "Demo_Create_File_For_Test_AmazonS3.txt"

    Try

        request.WithBucketName(bucket_name)
        request.WithKey(S3_KEY)
        request.WithContentBody("This is body of S3 object.")
        client.PutObject(request)
    Catch ex As Exception

    End Try

And, I have access permission like given below, which is given by my company for accessing Amazon S3 bucket. But I cannot able to access the bucket.It always shows "Access Denied" can you suggest Any access privilege that I should have, so i could access the bucket?

{ "Statement": [ { "Effect": "Allow", "Action": ["s3:"], "Resource": [ "arn:aws:s3:::scrape-pool/daily/" ] }, { "Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": [ "arn:aws:s3:::scrape-pool" ] } ] }

Please give any guidance Thanks

1 Answers1

0

That policy statement won't grant you full privileges on the bucket prefix. The section:

{ "Effect": "Allow", "Action": ["s3:"], "Resource": [ "arn:aws:s3:::scrape-pool/daily/" ] }

Should look like (adding a *):

{ "Effect": "Allow", "Action": ["s3:*"], "Resource": [ "arn:aws:s3:::scrape-pool/daily/" ] }

This will grant you full S3 permissions on that prefix.

Chad Smith
  • 1,589