---
title: AWS CLI for Fastly Object Storage
summary: null
url: >-
  https://www.fastly.com/documentation/guides/platform/object-storage/aws-cli-for-fastly-object-storage
---

The [Amazon Web Services (AWS) CLI](https://aws.amazon.com/cli/) can be configured to use [Fastly Object Storage](https://www.fastly.com/documentation/guides/platform/object-storage/about-object-storage) as an S3 backend.

## Prerequisites

1. Install AWS CLI v2. Refer to the [AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) for more information.
2. If you haven't already, purchase [Fastly Object Storage](https://www.fastly.com/products/storage).
3. Create an [Access Key and Secret Key](https://www.fastly.com/documentation/guides/platform/object-storage/working-with-object-storage) for Fastly Object Storage.

## Configure AWS CLI for Fastly Object Storage

1. Create or update the AWS CLI config file for your platform.

   
### Unix-based

   ```text
   ~/.aws/config
   ```

   ### Windows-based

   ```text
   C:\Users\USERNAME\.aws\config
   ```

   

   The config file contains [AWS CLI Profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html).

   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:

   ```ini copy nolinenums
   [profile fastly-us-west-1]
   region = us-west-1
   endpoint_url = https://us-west-1.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-us-central-1]
   region = us-central-1 
   endpoint_url = https://us-central-1.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-us-east-1]
   region = us-east
   endpoint_url = https://us-east.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-uk-east-1]
   region = uk-east-1
   endpoint_url = https://uk-east-1.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-eu-west-1]
   region = eu-west-1
   endpoint_url = https://eu-west-1.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-eu-central]
   region = eu-central
   endpoint_url = https://eu-central.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-eu-south-1]
   region = eu-south-1
   endpoint_url = https://eu-south-1.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-jp-central-1]
   region = jp-central-1
   endpoint_url = https://jp-central-1.object.fastlystorage.app
   request_checksum_calculation = when_required

   [profile fastly-au-east-1]
   region = au-east-1
   endpoint_url = https://au-east-1.object.fastlystorage.app
   request_checksum_calculation = when_required
   ```

2. Create or update the _credentials_ file for your platform

   
### Unix-based

   ```text
   ~/.aws/credentials
   ```

   ### Windows-based

   ```text
   C:\Users\USERNAME\.aws\credentials
   ```

   

   The 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. Instead, use one of the methods supported by AWS CLI for providing credentials such as through [environment variables](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html#envvars-list) or from [external tooling such as a password manager](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html).

   To do this for the example profiles above, we must edit the credentials file and add the following:

   ```ini copy nolinenums
   [fastly-us-west-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-us-central-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-us-east-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-uk-east-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-eu-west-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-eu-central]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-eu-south-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-jp-central-1]
   aws_access_key_id = 
   aws_secret_access_key = 

   [fastly-au-east-1]
   aws_access_key_id = 
   aws_secret_access_key = 
   ```

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.

> **HINT:** 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:

```term copy
$ aws s3 mb s3://photos --profile fastly-us-east
```

Upload a local file called `sunset.png` to the `photos` bucket:

```term copy
$ 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`:

```term copy
$ aws s3 cp s3://photos/sunset.png sunset-copy.png --profile fastly-us-east
```

Delete an object named `sunset.png` from the `photos` bucket:

```term copy
$ aws s3 rm s3://photos/sunset.png --profile fastly-us-east
```

Delete the photos bucket (the bucket must be empty before being deleted):

```term copy
$ aws s3 rb s3://photos --profile fastly-us-east
```

Refer to the [AWS CLI Documentation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/index.html) for more commands. Refer to Fastly Object Storage's documentation for additional [limitations and considerations](https://www.fastly.com/documentation/guides/platform/object-storage/about-object-storage#limitations-and-considerations).

## Related content

- [About Object Storage](https://www.fastly.com/documentation/guides/platform/object-storage/about-object-storage)
- [Working with Object Storage](https://www.fastly.com/documentation/guides/platform/object-storage/working-with-object-storage)
