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; however, for a CDN, a bucket should be publicly accessible.
- 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.
Create a site with an object storage origin
You can use these instructions to create a site with existing object storage as the origin.
To create object storage, see Enable object storage and create a bucket .
You can add the StackPath CDN in front of an object storage bucket to improve retrieval times on frequently accessed files and to experience the full benefit of the StackPath network.
StackPath does not charge for egress from Object Storage or ingress for CDN, which means all content retrievals from StackPath Object Storage to the CDN are free of charge. Please note that delivery from the CDN to end-users will count toward your CDN bandwidth allocation.
Step 1: Update your bucket and obtain the bucket URL
- In the StackPath Control Portal, in the left-side navigation, click Object Storage.
- Locate the desired bucket, and under Action, click the corresponding ellipses ( ... ), and then click Edit.
- Under Visibility, select Public.
- By default, buckets are set to Private.
- To use an object storage bucket with CDN, WAF, or EdgeEngine, the bucket must be publicly accessible. If you want to add protection to the bucket, you can add custom rules or whitelist / blacklist IP addresses.
- To learn more, see EdgeRules: Configure URL signing from the Control portal or Whitelist and Block Ips | WAF Rules .
- Click Edit to save your changes. You will be redirected to the details page for the bucket.
- Under Bucket URL, copy the URL. You will need this information later.
- Note that bucket URLs are case sensitive.
Step 2: Create a site
- In the StackPath Control Portal, in the left-side navigation, click Sites.
- Click Create Site.
- In Domain, enter the domain that will deliver the CDN assets. In most cases, simply enter your website's URL.
- Mark CDN. As an option, you can also select WAF to protect your site.
- Click Continue.
- In Hostname/IP Address, paste the copied bucket URL.
- Click Continue.
- In the left-side navigation menu, under Sites, click Settings.
- Next to Host Header, click Add New, paste the copied bucket URL, and then click Save.
Your bucket's content is now accessible over HTTP or HTTPS from your site's edge address.
Assets placed in object storage can now be pulled and cached on the CDN from you bucket via the following script: edge-address/path/to/object
.