Minimum commands to setup a public URL

0

I simply need to upload a CSV file to a public URL and I'm struggling to do this with S3 and the CLI.

bucket_name="aws-url-$(whoami)"
region="eu-west-2"
aws s3 mb s3://$bucket_name --region $region
aws s3 website s3://$bucket_name --index-document index.html
aws s3 cp foobar.csv s3://$bucket_name/foobar.csv --region $region
curl -i http://$bucket_name.s3-website.$region.amazonaws.com

It says 403 Forbidden.

When I try add --acl public-read I get:

 An error occurred (AccessControlListNotSupported) when calling the PutObject operation: The bucket does not allow ACLs

Which makes little sense to me. Where am I doing wrong please?

I do not want a presigned URL.

kai
asked 9 months ago187 views
1 Answer
0

Hello.

Is the public access blocking enabled?
Try running the following command to disable it and then add the ACL.

aws s3api put-public-access-block --bucket $bucket_name --public-access-block-configuration "BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false"
aws s3api put-bucket-acl --bucket $bucket_name --acl "public-read"
profile picture
EXPERT
answered 9 months ago
    • aws s3api put-public-access-block --bucket aws-url-hendry --public-access-block-configuration BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublic Buckets=false
    • aws s3api put-bucket-acl --bucket aws-url-hendry --acl public-read

    An error occurred (AccessControlListNotSupported) when calling the PutBucketAcl operation: The bucket does not allow ACLs

    • aws s3 website s3://aws-url-hendry --index-document index.html
    • aws s3 cp foobar.csv s3://aws-url-hendry/foobar.csv --region eu-west-2 --acl public-read upload failed: ./foobar.csv to s3://aws-url-hendry/foobar.csv An error occurred (AccessControlListNotSupported) when calling the PutObject operation: The bucket does not allow ACL

    Doesn't work

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions