Create a bucket
Create an Object Storage bucket from Azion Console, the Azion API, or the Azion CLI, then list, update, and delete your buckets.
You create a bucket in Object Storage from Azion Console, the Azion API, or the Azion CLI. The same three interfaces list your buckets, change a bucket’s access level, and delete a bucket.
A new bucket carries the name and the access level you set, and it appears in the bucket list of your account. For the objects that go inside it, refer to Upload and download objects.
Prerequisites
- A bucket name of 6 to 63 characters, built from letters, numbers, and the hyphen. The name cannot begin with
azion, and it is unique across every Azion account. A name that states the purpose, such asmedia-assets-prod, keeps a long list readable. - Access to Azion Console, for the Console procedure. Refer to Access Azion Console.
- A personal token, for the API procedures.
- The Azion CLI installed and authorized, for the CLI procedures.
Create a bucket using Azion Console
The create form asks for two values, one in General and one in Settings. To create the bucket:
Access Azion Console > Object Storage, and start a new bucket from the Buckets list.
In General, enter a Name that identifies what the bucket holds.
In Settings, set Workloads Access to the level the platform needs. The field defaults to Read Only:
- Read Only: the platform reads objects and does not modify them. Use it to serve static content through an application.
- Read & Write: the platform reads and writes objects, so a function can store data in the bucket.
- Restricted: the platform neither reads nor writes, and the bucket cannot back an application. The API and the S3 protocol still reach it.
The bucket appears in the Buckets list with the name you set.
Create a bucket using the API
Send a POST request to the buckets endpoint. Both name and workloads_access are required, and the create schema stores no other field. To create the bucket:
The API answers with HTTP 201, or 202 when it processes the request asynchronously, and returns the bucket it stored:
The bucket is stored under the name in data.name, and last_editor, last_modified, and product_version are read-only.
Create a bucket using the Azion CLI
The noun is storage, and the access level travels in --workloads-access. To create the bucket:
The command prints one line:
Run the command without flags and the Azion CLI prompts for each value. azion create storage bucket -h lists every flag it accepts.
List your buckets
Every interface returns the buckets of the account you are authenticated as.
Azion Console
The Object Storage page of Azion Console lists every bucket created in your account, under the Object Storage > Buckets breadcrumb. Each row carries Name, Size, Last Editor, and Last Modified.
The API
Send a GET request to the buckets endpoint:
The response carries the buckets under results, with the page it belongs to:
The envelope also carries next and previous. Page through a longer list with page and page_size, where page_size stops at 100. To find one bucket, search matches a name partially and name matches it exactly.
The Azion CLI
Send the list command, with the page size you want:
The command prints a table with a NAME column and a WORKLOADS ACCESS column, and --page moves to the next page.
Change a bucket’s access level
workloads_access decides what the Azion platform may do with the bucket. It does not restrict the API or the S3 protocol: a credential that carries writeFiles writes to a read_only bucket.
| Value | Console label | The Azion platform may | The API and the S3 protocol may |
|---|---|---|---|
read_only | Read Only | Read objects | Read and write, per the credential |
read_write | Read & Write | Read and write objects | Read and write, per the credential |
restricted | Restricted | Neither read nor write, and the bucket cannot back an application | Read and write, per the credential |
Azion Console
To change the level:
Access Azion Console > Object Storage, then select the bucket in the Buckets list. The Bucket settings page opens.
In Settings, set Workloads Access to the value you want.
The bucket carries the new access level.
The API
Send a PATCH request to the bucket, with workloads_access as the only field:
The API answers with HTTP 200, or 202 when it processes the request asynchronously, and returns the bucket with the new level:
The Azion CLI
Name the bucket with --name and the new level with --workloads-access:
The command prints one line:
azion update storage bucket -h lists every flag it accepts.
Delete a bucket
A bucket is deleted only while it is empty.
Azion Console
To delete the bucket:
Access Azion Console > Object Storage, then select the bucket in the Buckets list. The Bucket settings page opens.
The control sits in Danger Zone, which warns that the action permanently removes the bucket and all of its associated data from the Azion platform, and cannot be undone.
The bucket leaves the Buckets list.
The API
Send a DELETE request to the bucket:
The API answers with state set to executed:
The Azion CLI
Name the bucket with --name:
The command names the bucket it removed:
A deleted bucket no longer answers any request, and the API returns error 17005, Bucket Does Not Exist, for it.