Overview
You can use this document to create and manage object storage buckets.
You can use object storage buckets to store, manage, and serve files remotely without the need of a personally managed server.
Before you begin:
- To manage the contents of your bucket, you must install the AWS CLI tool. To learn more, visit the AWS documentation site and see What Is the AWS Command Line Interface?.
- To understand object storage billing, see Object Storage Billing FAQ.
Create an object storage bucket
- In the StackPath Control Portal, in the top-right corner, select your username.
- In the drop-down menu, click My Stacks.
- Locate and select your stack. The portal will refresh.
- In the left-side navigation menu, click Object Storage.
- Click Create Bucket.
- Enter a descriptive name for your bucket, select a region, and then click Continue.
- (Optional) By default, the bucket is private upon creation; however, for a CDN, a bucket should be publicly accessible. If you'd like to maintain your bucket's private status, please refer to this guide.
- In the Object Storage details page, in top, right corner, click the gear icon. Under Visibility, select Public, and then click Edit to save your changes.
Access and manage your bucket
Before you begin, to manage the content of your bucket, you must install the AWS CLI tool. To learn more, see What Is the AWS Command Line Interface?.
- In the StackPath Control Portal, in the left-side navigation, click Object Storage.
- Under the list of buckets, click Generate Credentials to create your client access key and secret.
- Review the message in the pop-up window, and then click Generate Credentials.
- Store Access Key and Secret Key in a safe location.
- A secret key cannot be recovered. If you lose your secret key, you will have to generate a new key, which will replace the existing secret.
- To access the storage bucket with the CLI, enter the following command:
aws configure
- When asked, enter your Access Key and Secret Key. For the region, enter us-east-1. The last setting you can leave blank.
- To access your bucket, in the command line, enter the appended endpoint URL.
- To locate your endpoint URL, in the StackPath Control Portal, in the left-side navigation menu, click Object Storage. Locate and select the desired bucket. Copy the endpoint URL. Note that the endpoint URL and bucket URL will vary based on the region.
- In the command line, append the endpoint with aws s3 ls --endpoint-url=, followed by the endpoint URL.
aws s3 ls --endpoint-url=https://s3.us-east-1.stackpathstorage.com
- You can now access your StackPath storage bucket through the AWS CLI tool.
Obtain your bucket URL
When you use the AWS CLI tool to access your bucket, you will need to add the bucket URL in the various commands. The bucket URL includes your bucket's name and location (region).
- In the StackPath Control Portal, in the left-side navigation menu, click Object Storage.
- Locate and select the desired bucket.
- Locate Bucket URL.
Upload a file to your bucket
To upload files to your bucket, use the following command:
aws s3 cp /path/to/your/file s3://YOUR_BUCKET_NAME/ --endpoint-url=https://s3.us-east-1.stackpathstorage.com
To upload a specific file to your bucket that has public access, even if the bucket is private, append --acl public-read to your command:
aws s3 cp /path/to/your/file s3://YOUR_BUCKET_NAME/ --endpoint-url=https://s3.us-east-1.stackpathstorage.com --acl public-read
If you do not know your bucket's name or location, see Obtain your bucket URL.
Recursively upload a folder to your bucket
To upload an entire folder or multiple files to a bucket, use the --recursive flag when cp'ing your files/folders:
aws s3 cp /path/to/your/file s3://YOUR_BUCKET_NAME/ --endpoint-url=https://s3.us-east-1.stackpathstorage.com --recursive
If you do not know your bucket's name or location, see Obtain your bucket URL.
To learn more about the cp command, visit the AWS CLI Command Reference site.
Access public files in your bucket
After you upload a public file to your bucket, you can use the following URL to access the uploaded content:
http(s)://YOUR_BUCKET_NAME.s3.US-BUCKET-LOCATION.stackpathstorage.com/path/to/your/file
If you do not know your bucket's name or location, see Obtain your bucket URL.
Remove files from your bucket
To remove files from a bucket, use the following command:
aws s3 rm s3://YOUR_BUCKET_NAME/path/to/your/file --endpoint-url=https://s3.us-east-1.stackpathstorage.com
If you do not know your bucket's name or location, see Obtain your bucket URL.
To learn. more about the rm command, visit the AWS CLI Command Reference site.