How to Manage S3 Bucket Access Control Lists (ACLs)

Access Control Lists ( ACLs ) define who has access to a Space or to a single object and to what extent . ACLs can be used by S3 compatible object storage to decide whether files are private or publicly readable .

Access permissions to Cyberin S3 Object Storage can be controlled using the dashboard or an S3-compatible API client. In this article, we’ll walk you through checking and updating ACLs, setting up private or public-read access, and troubleshooting common permission issues.

Note: DigitalOcean Spaces supports two canned ACLs - private and public_read. A private ACL allows access only to the owner. A public-read ACL allows anyone on the internet to read the object. Share files publicly only when you intend to share them publicly.

Step 1: Configure the S3 Endpoint

DigitalOcean Spaces provides a regional endpoint for S3-compatible API requests.

For example, in the sgp1 region, space is used as follows:

https://sgp1.digitaloceanspaces.com

Substitute region with the actual region of your Space. Before running the commands below, configure your S3 client with the correct access key and secret key.

Step 2: Check the Bucket ACL

You can get the ACL for a Space with the get-bucket-acl command.

aws s3api get-bucket-acl \
  --bucket YOUR_SPACE_NAME \
  --endpoint-url https://YOUR_REGION.digitaloceanspaces.com

Replace YOUR_SPACE_NAME and YOUR_REGION with your Space name and region.

The response includes the owner information, as well as the permissions allowed by the ACL. Check the output for which access permissions are set.

Step 3: Set the Bucket ACL to Private

To limit bucket level access using ACL, use the command put-bucket-acl with a private setting.

aws s3api put-bucket-acl \
  --bucket YOUR_SPACE_NAME \
  --acl private \
  --endpoint-url https://YOUR_REGION.digitaloceanspaces.com

This makes the bucket ACL private. It does not delete the Space or any files contained in it.

Note: A private ACL doesn’t ensure each object is not publicly accessible if another access mechanism, such as a bucket policy or public URL configuration, grants access. Review other access settings as appropriate.

Step 4: Allow Public Read Access When Required

If you want to use a Space to host public files, you can apply the public-read ACL.

aws s3api put-bucket-acl \
  --bucket YOUR_SPACE_NAME \
  --acl public-read \
  --endpoint-url https://YOUR_REGION.digitaloceanspaces.com

This allows unauthenticated users to read ACL protected resources. Do not use this setting for backups, confidential documents, private user uploads, or other sensitive files.

If you want to make a single file public, consider changing the ACL on that object rather than making the whole Space public.

Step 5: Manage an Individual Object's ACL

You can retrieve an object's ACL using get-object-acl.

aws s3api get-object-acl \
  --bucket YOUR_SPACE_NAME \
  --key path/to/your-file.pdf \
  --endpoint-url https://YOUR_REGION.digitaloceanspaces.com

To set an individual object to private:

aws s3api put-object-acl \
  --bucket YOUR_SPACE_NAME \
  --key path/to/your-file.pdf \
  --acl private \
  --endpoint-url https://YOUR_REGION.digitaloceanspaces.com

To allow public read access to an individual object:

aws s3api put-object-acl \
  --bucket YOUR_SPACE_NAME \
  --key path/to/your-file.pdf \
  --acl public-read \
  --endpoint-url https://YOUR_REGION.digitaloceanspaces.com

Change the object key to the full path and file name of the file you wish to manage.

Before you use a public ACL, verify that the file is intended to be public. Anyone who can access a publicly readable object can view or download that object without authentication.

Step 6: Verify the Updated ACL

After you change an ACL, run the appropriate get-bucket-acl or get-object-aclcommand again.

Make sure:

If the file is still public after you have made its ACL private, you may need to check bucket policies, public URLs, or CDN configurations that may be active.

Troubleshooting

Access denied: Confirm that the access key has the required bucket-level or object-level permissions. Bucket ACL updates require broader permissions than object ACL updates.

The file remains publicly accessible: Check whether another access mechanism, such as a bucket policy or CDN URL, permits access. A private ACL does not automatically override every other permission setting.

The ACL update fails: Verify the endpoint, Space name, object key, and credentials. Also confirm that the selected ACL is supported.

A file cannot be accessed after changing its ACL: Confirm that the file is intended to be public and that the request uses the correct URL. Private objects generally require authorized access, such as a properly configured authenticated request or presigned URL.

An unsupported ACL is rejected: DigitalOcean Spaces supports the canned ACLs private and public-read. Do not assume that every ACL option available in Amazon S3 is supported.

Additional Resources