AWS CLI
The AWS CLI is Amazon's official command-line tool for interacting with S3 (and many other AWS services). It's the most reliable way to script Filebase operations from a shell.
Install
| Platform | Command |
|---|---|
| macOS | brew install awscli |
| Linux | curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscli.zip && unzip awscli.zip && sudo ./aws/install |
| Windows | Download the installer from aws.amazon.com/cli |
Verify with aws --version. Filebase requires AWS CLI v2 or v1.18+.
Configure
aws configure
| Prompt | Value |
|---|---|
| AWS Access Key ID | Your Filebase access key |
| AWS Secret Access Key | Your Filebase secret key |
| Default region name | auto |
| Default output format | json (recommended) or text |
The endpoint is not stored in configuration — pass --endpoint https://s3.filebase.io on every call. To save typing, alias it:
alias aws-fb='aws --endpoint https://s3.filebase.io'
Then aws-fb s3 ls is all you need to list your buckets.
Common operations
Buckets
# List buckets
aws --endpoint https://s3.filebase.io s3 ls
# Create
aws --endpoint https://s3.filebase.io s3 mb s3://my-bucket
# Delete (must be empty, or use --force)
aws --endpoint https://s3.filebase.io s3 rb s3://my-bucket --force
Objects
# Upload
aws --endpoint https://s3.filebase.io s3 cp ./photo.jpg s3://my-bucket/
# Download
aws --endpoint https://s3.filebase.io s3 cp s3://my-bucket/photo.jpg ./
# Sync directory → bucket
aws --endpoint https://s3.filebase.io s3 sync ./local-folder/ s3://my-bucket/uploads/
# Sync bucket → directory
aws --endpoint https://s3.filebase.io s3 sync s3://my-bucket/ ./local-backup/
# List objects
aws --endpoint https://s3.filebase.io s3 ls s3://my-bucket/ --recursive
# Delete
aws --endpoint https://s3.filebase.io s3 rm s3://my-bucket/photo.jpg
# Bulk delete with prefix
aws --endpoint https://s3.filebase.io s3 rm --recursive s3://my-bucket/old-photos/
Object metadata
aws --endpoint https://s3.filebase.io s3api head-object \
--bucket my-bucket --key photo.jpg
Set Cache-Control on upload
aws --endpoint https://s3.filebase.io s3 cp ./style.css s3://my-bucket/ \
--content-type "text/css" \
--cache-control "public, max-age=31536000, immutable"
Public bucket creation
aws --endpoint https://s3.filebase.io s3api create-bucket \
--bucket my-public-bucket \
--acl public-read
Pre-signed URLs
aws --endpoint https://s3.filebase.io s3 presign s3://my-bucket/private.pdf \
--expires-in 3600
Multipart upload
The CLI switches to multipart automatically once an upload exceeds 8 MB. To tune:
aws configure set default.s3.multipart_threshold 64MB
aws configure set default.s3.multipart_chunksize 64MB
To restart a failed multipart upload, just re-run s3 cp — the CLI checks for in-progress uploads and resumes when possible.
CORS and lifecycle config
# Apply CORS
aws --endpoint https://s3.filebase.io s3api put-bucket-cors \
--bucket my-bucket \
--cors-configuration file://cors.json
# View CORS
aws --endpoint https://s3.filebase.io s3api get-bucket-cors --bucket my-bucket
# View lifecycle config (typically empty)
aws --endpoint https://s3.filebase.io s3api get-bucket-lifecycle-configuration \
--bucket my-bucket
Profiles for multiple accounts
If you have separate Filebase accounts for staging vs. production, configure profiles:
aws configure --profile filebase-prod
aws configure --profile filebase-stage
Then:
aws --profile filebase-prod --endpoint https://s3.filebase.io s3 ls
What's next
- Pre-signed URLs
- Multipart upload
- rclone — better choice for many sync workflows
- Backup recipes