AWS CLI for Fastly Object Storage
Last updated 2025-03-24
The Amazon Web Services (AWS) CLI can be configured to use Fastly Object Storage as an S3 backend.
Prerequisites
- Install AWS CLI v2. Refer to the AWS documentation for more information.
- If you haven't already, purchase Fastly Object Storage.
- Create an Access Key and Secret Key for Fastly Object Storage.
Configure AWS CLI for Fastly Object Storage
Create or update the AWS CLI config file for your platform.
- Unix-based
- Windows-based
~/.aws/configThe config file contains AWS CLI Profiles.
Each Fastly Object Storage region should be added as an individual profile for AWS CLI. These profiles can be named whatever you would like, but below we include the Fastly Object Storage region in the profile name to make it clear which region is associated with which profile.
The config file for your system should have the following added to it:
[profile fastly-us-east]region = us-eastendpoint_url = https://us-east.object.fastlystorage.apprequest_checksum_calculation = when_required[profile fastly-us-west]region = us-westendpoint_url = https://us-west.object.fastlystorage.apprequest_checksum_calculation = when_required[profile fastly-eu-central]region = eu-centralendpoint_url = https://eu-central.object.fastlystorage.apprequest_checksum_calculation = when_requiredCreate or update the credentials file for your platform
- Unix-based
- Windows-based
~/.aws/credentialsThe credentials file contains the Fastly Object Storage access credentials associated with a like-named profile in the config file.
WARNING
The following steps will store your Fastly Object Storage credentials in plaintext in a file on disk. This is not recommended in a production environment.
For production environments, AWS CLI supports other methods of providing credentials such as through environment variables or from external tooling such as a password manager.
To do this for the example profiles above, we must edit the credentials file and add the following:
[fastly-us-east]aws_access_key_id = <YOUR FASTLY OBJECT STORAGE ACCESS KEY ID HERE>aws_secret_access_key = <YOUR FASTLY OBJECT STORAGE SECRET KEY HERE>[fastly-us-west]aws_access_key_id = <YOUR FASTLY OBJECT STORAGE ACCESS KEY ID HERE>aws_secret_access_key = <YOUR FASTLY OBJECT STORAGE SECRET KEY HERE>[fastly-eu-central]aws_access_key_id = <YOUR FASTLY OBJECT STORAGE ACCESS KEY ID HERE>aws_secret_access_key = <YOUR FASTLY OBJECT STORAGE SECRET KEY HERE>
The AWS CLI is now ready to be used with Fastly Object Storage.
Basic AWS CLI Commands
The following provides a sample of common commands to interact with Fastly Object Storage via the AWS CLI.
TIP
Note the use of the --profile
flag to choose which Fastly Object Storage region to perform commands against.
Create a bucket named photos
in the us-east
region:
$ aws s3 mb s3://photos --profile fastly-us-east
Upload a local file called sunset.png
to the photos
bucket:
$ aws s3 cp sunset.png s3://photos/sunset.png --profile fastly-us-east
Download the object named sunset.png
from the photos
bucket to a local file called sunset-copy.png
:
$ aws s3 cp s3://photos/sunset.png sunset-copy.png --profile fastly-us-east
Delete an object named sunset.png
from the photos
bucket:
$ aws s3 rm s3://photos/sunset.png --profile fastly-us-east
Delete the photos bucket (the bucket must be empty before being deleted):
$ aws s3 rb s3://photos --profile fastly-us-east
Refer to the AWS CLI Documentation for more commands. Refer to Fastly Object Storage's documentation for additional limitations and considerations.
Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.