Guides - Using the AWS CLI with Object Storage
An S3-compatible object storage solution designed to store, manage, and access unstructured data in the cloud.
Amazon’s AWS CLI is a command-line tool that can be used to interface with Linode’s Object Storage service.
Installing the AWS CLI version 2 is typically accomplished by downloading a package for your operating system and installing that package. Since there is not currently an official way to do this through a package manager, you must download the package manually. To do this, follow the instructions for your operating system on the Installing or updating the latest version of the AWS CLI guide.
Run the following command in your preferred terminal:
You are then prompted to fill out a few parameters:
- AWS Access Key ID: Enter the access key you wish to use. See Managing Access Keys.
- AWS Secret Access Key: Enter the secret key that corresponds with the access key. This was displayed once when generating the access key.
- Default region name: Press enter without inputting any characters to keep the default
usregion. Do not change this, even if you use Object Storage in region outside the U.S.
- Default output format: Press enter without inputting any characters.
- Endpoint URL: When using the AWS CLI with a non-AWS service, like Linode’s Object Storage, you must always specify the endpoint url in each command. This is done through the
--endpointparameter. When using the commands in this guide, always replace [endpoint-url] with the cluster URL that corresponds with the data center you’re using (see Cluster URL (S3 endpoint)).
List all buckets within the data center specified during the configuration process.
aws s3 ls --endpoint=[endpoint-url], replacing [endpoint-url]
Example: List all buckets on the account within the Atlanta data center:
aws s3 ls --endpoint=https://us-southeast-1.linodeobjects.com
Creates a bucket with the specified bucket label. See the Create and Manage Buckets guide for rules on naming the bucket.
aws s3 mb s3://[bucket-label] --endpoint=[endpoint-url] --region=us-east-1, replacing [bucket-label] with the label you’d like to use for the new bucket.
Example: Create a bucket with the label of “example-bucket” in the Atlanta data center:
aws s3 mb s3://example-bucket --endpoint=https://us-southeast-1.linodeobjects.com --region=us-east-1
Deletes the bucket with the specified label.
s3cmd rb s3://[bucket-label], replacing [bucket-label] with the label of the bucket you wish to delete.
Example: Delete the bucket with the label of “example-bucket”:
s3cmd rb s3://example-bucket
To delete a bucket that has files in it, include the
-r) option and the
-f) option. Use caution when running this command:
s3cmd rb -r -f s3://example-bucket/
This page was originally published on