In order to activate Object Storage, you will need to have an active StackPath account with an Active Stack.
In order to use StackPath Object Storage, you will need to enable it on your existing Stack.
Enable Object Storage on a Stack
If you do not already have any existing services enabled on your account, to use Object Storage you'll first need to create a Stack. You will also need to make sure you have a payment method on file as Object Storage is a pay as you go model. You will not be billed until your next billing cycle and you will only be charged for the GB's used.
- Log into the StackPath Control Portal and select an active Stack
- Select Object Storage in the left-hand navigation bar
- Select Continue to enable it on your stack
Your StackPath Object Storage service is now enabled.
Create your first bucket
Now that we have the Object Storage enabled, let's create your first bucket. Simply click the Create Bucket button above and you will be taken to the Create Bucket form.
That's it! Once you click Create your bucket will be created instantly. Buckets are created with Private permissions by default, but if you want to open your bucket up to Public permissions (useful for using with the CDN) you can click Edit and change your Visibility to Public.
Accessing your Bucket
In order to manage the content of your bucket, you will need the AWS CLI tool found at https://docs.aws.amazon.com/cli/latest/userguide/install-bundle.html
- Go back to the main Object Storage page by clicking Object Storage in the sidebar
- Click the Generate Credentials button below the list of buckets to create your client access key and secret
- Click Generate Credentials on the Modal to confirm you want to create a new set of credentials. Once completed, you will want to copy the Access Key and Access Secret to a safe place.
Note: Secret's cannot be recovered. If you lose your secret you will have to generate a new one which will destroy the existing Secret.
- Now that we have our Access Key and Secret Key we can configure the AWS CLI tool to work with them:
In order to access your StackPath Storage buckets with the CLI, you must utilize the configure command.
aws configurewill bring up a series of prompts. Where it calls for the access key and secret access key you will enter your access key and secret key created above. For the region, type "us-east-1". Finally, you can leave the last setting blank.
- To access your bucket you will need to append the Endpoint URL provided in the StackPath Control Portal when viewing your bucket to your command. (Example: https://s3.us-east-1.stackpathstorage.com)
The endpoint URL and bucket URL will vary, reflecting the region used to create the bucket.
aws s3 ls --endpoint-url=https://s3.us-east-1.stackpathstorage.comThat's it! You have now configured your AWS CLI tool to have access to your StackPath Storage bucket.
Uploading a file to your Bucket
Now that your AWS CLI tool is configured for your bucket, let's upload your first file!
aws s3 cp /path/to/your/file s3://YOUR_BUCKET_NAME/ --endpoint-url=https://s3.us-east-1.stackpathstorage.com
As you can see the above command works exactly as it does for any S3 compatible bucket. The only difference is we have to add --endpoint-url=https://s3.YOUR-ENDPOINT-URL.stackpathstorage.com to our command so the CLI tool knows where to send the file.
If you want to upload a specific file to your bucket that has public access (even if the bucket is Private) you can append --acl public-read to your command like so:
aws s3 cp /path/to/your/file s3://YOUR_BUCKET_NAME/ --endpoint-url=https://s3.us-east-1.stackpathstorage.com --acl public-read
How to recursively upload a folder to your Bucket
If you have an entire folder or multiple files you want to upload to your Bucket you will need to 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
For more details and features around the cp command, please see https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html
How to access Public Files in your Bucket
Once you upload a public file to your bucket, it can be accessed with the following URL:
Note: The exact URL can always be found in the StackPath Control Portal when viewing your Bucket
Removing files from your bucket
Removing files from your bucket is no different than removing files from S3 using the AWS CLI tool.
aws s3 rm s3://YOUR_BUCKET_NAME/path/to/your/file --endpoint-url=https://s3.us-east-1.stackpathstorage.com
For more details and features around the rm command, please see https://docs.aws.amazon.com/cli/latest/reference/s3/rm.html
That should cover getting started with StackPath Object Storage. As always if you have any questions or need any assistance please do not hesitate to reach out to our 24x7 Live Chat or Helpdesk support.