Reputation: 1755
I have created a bucket & after image uploaded from my website development server it store as XML file, If I go to bucket and make it public manually it becomes available to all and I am able to get that file.
What might be the problem here ?
setting each uploaded file to public as below
I set access= objects can be public
Block all public access = False
CORS CONFIGURATION
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<ExposeHeader>ETag</ExposeHeader>
<ExposeHeader>x-amz-meta-custom-header</ExposeHeader>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
INITIAL ERROR WHEN TRYING TO ACCESS THE UPLOADED IMAGE
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>InvalidRequest</Code>
<Message>The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.</Message>
<RequestId>XX</RequestId>
<HostId>XXZjXX</HostId>
</Error>
Upvotes: 1
Views: 682
Reputation: 238967
If I go to bucket and make it public manually it becomes available to all and I am able to get that file. What might be the problem here ?
You don't have to do it manually. Instead, to automatically make all objects in your bucket publicly readable , a bucket policy can be added:
For example:
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"PublicRead",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::<your-bucket-name>/*"]
}
]
}
You will also need to keep block public access settings
disabled.
Upvotes: 1
Reputation: 35258
The setting itself is to allow them the ability to be public.
If you want all objects (or those with a specific prefix) then take a look at create a S3 bucket policy that allows the S3:GetObject
permission.
An example of this bucket policy is available here.
Upvotes: 1