Skip to main content

AWS CLI Examples

Use a named AWS CLI profile for Files.com. Configure a path-style profile with:

aws configure --profile files-path
aws configure set s3.addressing_style path --profile files-path

Enter your Files.com S3-compatible Access Key ID and Secret Access Key when prompted, and use us-east-1 for the region. These credentials belong to Files.com, not to an AWS account.

For virtual-hosted-style access, configure a separate profile with the same credentials:

aws configure --profile files-virtual
aws configure set s3.addressing_style virtual --profile files-virtual

The AWS CLI otherwise uses automatic addressing-style selectionExternal LinkThis link leads to an external website and will open in a new tab, so these examples set the style explicitly. Path-style uses the bucket default; virtual-hosted-style uses your site's custom subdomain as the bucket. Replace mysite below with that subdomain.

List the available bucket with either profile:

aws s3 ls --endpoint-url https://s3.files.com --profile files-path
aws s3 ls --endpoint-url https://s3.files.com --profile files-virtual

Uploading, Downloading, and Managing Objects

Files.com supports standard S3 object operations for uploading, retrieving, listing, and deleting files.

Upload an Object

# path-style:
aws s3 cp /path/to/myfile.txt s3://default/destinationfolder/myfile.txt --endpoint-url https://s3.files.com --profile files-path

# virtual-hosted-style:
aws s3 cp /path/to/myfile.txt s3://mysite/destinationfolder/myfile.txt --endpoint-url https://s3.files.com --profile files-virtual

Download an Object

# path-style:
aws s3 cp s3://default/folder/myfile.txt /downloads/myfile.txt --endpoint-url https://s3.files.com --profile files-path

# virtual-hosted-style:
aws s3 cp s3://mysite/folder/myfile.txt /downloads/myfile.txt --endpoint-url https://s3.files.com --profile files-virtual

List Objects

# path-style:
aws s3 ls s3://default/ --endpoint-url https://s3.files.com --profile files-path

# virtual-hosted-style:
aws s3 ls s3://mysite/ --endpoint-url https://s3.files.com --profile files-virtual

Delete an Object

# path-style:
aws s3 rm s3://default/folder/myfile.txt --endpoint-url https://s3.files.com --profile files-path

# virtual-hosted-style:
aws s3 rm s3://mysite/folder/myfile.txt --endpoint-url https://s3.files.com --profile files-virtual