Managing buckets
A bucket is a named container for your files (objects). Create a separate bucket for each purpose or application, for example one for backups and one for website assets. That makes it easy to give each one its own bucket policy, versioning and lifecycle rules.
Before you start: enable S3 access.
Bucket names
- 3 to 63 characters
- Lowercase letters, numbers, hyphens (
-) and periods (.) only - Must start and end with a letter or number
- No uppercase letters, underscores or spaces
Choose a name you're happy to keep. Buckets can't be renamed. If a name is already in use, pick another.
:::note Planning to use Object Lock? Object Lock can only be turned on when the bucket is created, and only with the API. Decide before you create a backup bucket. :::
Create a bucket
In the web panel
- Go to S3 > Buckets.
- Click Create bucket.
- Enter a name and click Create.
With aws-cli (see Using the S3 API for setup)
cd ~
aws s3 mb s3://<bucket> --profile bamboozle
View a bucket's contents
In the web panel: go to S3 > Buckets and click the bucket name.
With aws-cli:
cd ~
aws s3 ls s3://<bucket>/ --recursive --human-readable --summarize --profile bamboozle
--summarize prints the number of objects and total size at the end.
Check a bucket's settings
Versioning, Object Lock, policies and lifecycle rules are read with the API:
cd ~
aws s3api get-bucket-versioning --bucket <bucket> --profile bamboozle
aws s3api get-object-lock-configuration --bucket <bucket> --profile bamboozle
aws s3api get-bucket-policy --bucket <bucket> --profile bamboozle
aws s3api get-bucket-lifecycle-configuration --bucket <bucket> --profile bamboozle
An error such as NoSuchBucketPolicy or NoSuchLifecycleConfiguration means that setting isn't configured.
Delete a bucket
You can only delete an empty bucket. Deleting a bucket can't be undone.
In the web panel
- Go to S3 > Buckets and click the bucket.
- In the right pane, click Delete.
- Confirm with Delete.
With aws-cli
cd ~
aws s3 rb s3://<bucket> --profile bamboozle
aws s3 rb --force deletes all current files first, then the bucket. On a bucket with versioning, older versions and delete markers also have to be removed before the bucket counts as empty. Objects under Object Lock can't be removed until their retention ends.