When I try to download one file from AWS S3 through console, I am getting following error:
This XML file does not appear to have any style information associated with it.
The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>DF19E559FDBA71C2</RequestId>
<HostId>f5cIaO8eh2yTmC+rtVIVg54xY4EXAjG6lsxzjbBjzMRwDWaMFaggAU3Wyoipy2ZuDHQLhz402DE=</HostId>
</Error>
Can someone please help with this.
Thanks in advance
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. The bucket policy denies your IAM identity permission for s3:GetBucketPolicy and s3:PutBucketPolicy.
Open the IAM console. Add a policy to the IAM user that grants the permissions to upload and download from the bucket. You can use a policy that's similar to the following: Note: For the Resource value, enter the Amazon Resource Name (ARN) for the bucket with a wildcard character to indicate the objects in the bucket.
The URL to the Amazon S3 object doesn't include your user credentials, so the request to the object is anonymous. Amazon S3 returns an Access Denied error for anonymous requests to objects that aren't public.
You are getting this error because the file is set to private and you don't have the permission do download it. To do so, you must set a Bucket Policy according to the permissions you with to use.
If you want any user to be able to download bucket objects, you can set a policy such as:
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"PublicRead",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::examplebucket/*"]
}
]
}
Another option, if you want to serve content, is to use Amazon CloudFront as a CDN.
Finally, it is important to understand what kind of access you need to download your files to set the appropriate policy.
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