I am trying to figure out how to configure an AWS S3 bucket so that I can upload to it. I followed the instructions in this tutorial, but am still getting an error that says:
Access to fetch at 'https://s3.ap-southeast-2.amazonaws.com/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I have a bucket (in dev) with the following CORS policy:
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
I have a bucket policy as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:List*",
"s3:Get*"
],
// Note: I have also tried using the wildcard '*' to allow all actions, but i get the same error message as shown above
"Resource": [
"arn:aws:s3:::[MY_BUCKET_NAME]",
"arn:aws:s3:::[MY_BUCKET_NAME]/*"
]
}
]
}
I can see that the AWS policy has an additional ACL section, which has options to tick list and read, but the write button is greyed out with a warning not to use it to allow everyone to write. I ticked them to allow public access to everyone to list and read (I don't know how to edit the greyed out write option). I am in dev mode and would like to find a way to test if the connection can be made to function, so would like to write. Even when I try this, I get the same error as posted above.
I am looking for current instructions on how to connect to an AWS S3 bucket. It seems the config requirements change faster than blog tutorials are created. Many of the answers on SO no longer map to the config settings in the AWS S3 profile.