So I set up a space with CDN. When I copy files to it, they become private by default.
So I set the bucket ACL to public read:
aws s3api --endpoint=https://fra1.digitaloceanspaces.com put-bucket-acl --acl public-read --bucket $MYBUCKETNAME
When I read it back it is indeed public:
aws s3api --endpoint=https://fra1.digitaloceanspaces.com get-bucket-acl --bucket $MYBUCKETNAME
{
"Owner": {
"DisplayName": "REDACTED",
"ID": "REDACTED"
},
"Grants": [
{
"Grantee": {
"Type": "Group",
"URI": "http://acs.amazonaws.com/groups/global/AllUsers"
},
"Permission": "READ"
},
{
"Grantee": {
"Type": "CanonicalUser",
"DisplayName": "REDACTED",
"ID": "REDACTED"
},
"Permission": "FULL_CONTROL"
}
]
}
However, when I copy new files to the bucket, they’re still set to ‘private’. I have to do a recursive set per file, but this takes a long time.
s3cmd setacl s3://$MYBUCKETNAME/ --acl-public --recursive
How can I set the default ACL to public so that new files are public by default?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.
Unfortunately, DigitalOcean Spaces does not currently support setting a default ACL for new objects. As a workaround, when you upload new files to your Space, you must specifically set the ACL to public-read for each file. You can do this using the following command:
aws s3api --endpoint=https://<REGION>.digitaloceanspaces.com put-object-acl --acl public-read --bucket <YOUR-BUCKET-NAME> --key <YOUR-FILE-NAME>
Alternatively, you can use the s3cmd tool:
s3cmd setacl s3://<YOUR-BUCKET-NAME>/<YOUR-FILE-NAME> --acl-public
For more information on working with DigitalOcean Spaces and ACLs, please refer to the DigitalOcean documentation.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.