I am trying to give myself permission to download existing files in an S3 bucket. I've modified the Bucket Policy, as follows:
{ "Sid": "someSID", "Action": "s3:*", "Effect": "Allow", "Resource": "arn:aws:s3:::bucketname/AWSLogs/123123123123/*", "Principal": { "AWS": [ "arn:aws:iam::123123123123:user/myuid" ] } }
My understanding is that addition to the policy should give me full rights to "bucketname" for my account "myuid", including all files that are already in that bucket. However, I'm still getting Access Denied errors when I try to download any of those files via the link that comes up in the console.
Any thoughts?
If you're trying to host a static website using Amazon S3, but you're getting an Access Denied error, check the following requirements: Objects in the bucket must be publicly accessible. S3 bucket policy must allow access to the s3:GetObject action. The AWS account that owns the bucket must also own the object.
Short description. The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy.
You can use the NotPrincipal element of an IAM or S3 bucket policy to limit resource access to a specific set of users. This element allows you to block all users who are not defined in its value array, even if they have an Allow in their own IAM user policies.
Step 1
Click on your bucket name, and under the permissions tab, make sure that Block new public bucket policies is unchecked
Step 2
Then you can apply your bucket policy
Hope that helps
David, You are right but I found that, in addition to what bennie said below, you also have to grant view (or whatever access you want) to 'Authenticated Users'.
But a better solution might be to edit the user's policy to just grant access to the bucket:
{ "Statement": [ { "Sid": "Stmt1350703615347", "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::mybucket/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": ["arn:aws:s3:::mybucket"], "Condition": {} } ] }
The first block grants all S3 permissions to all elements within the bucket. The second block grants list permission on the bucket itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With