How to create an Object Storage bucket
This guide shows how to use Azion Object Storage service to create a read-only bucket and assign read-write permissions using the Azion API.
Creating a bucket
Requirements
To create a bucket:
azion create edge-storage bucketAzion CLI will present a series of interactions, so the bucket can be created. Run azion update edge-storage bucket -h for further information.
Run the following POST request in your terminal, replacing [TOKEN VALUE] with your personal token and name with the desired bucket name to create a new read-only bucket:
curl --location 'https://api.azion.com/v4/storage/buckets' --header 'Accept: application/json;' --header 'Content-Type: application/json' --header 'Authorization: Token [TOKEN VALUE]' --data '{ "name": "my-bucket-ro", "edge_access": "read_only"}'You should receive the following response:
{ "state": "executed", "data": { "name": "my-bucket-ro", "edge_access": "read_only" }}Attributing read-write permission to bucket
Requirements
To create a bucket:
azion update edge-storage bucketAzion CLI will present a series of interactions, so the bucket can be updated. Run azion update edge-storage bucket -h for further information.
Run the following PATCH request in your terminal, replacing [TOKEN VALUE] with your personal token and bucket_name with the name of the bucket to attribute the read-write permission:
curl --location --request PATCH 'https://api.azion.com/v4/storage/buckets/<bucket_name>' --header 'Accept: application/json;' --header 'Content-Type: application/json' --header 'Authorization: Token [TOKEN VALUE]' --data '{ "edge_access": "read_write"}'You should receive the following response:
{ "state": "executed", "data": { "name": "my-bucket-ro", "edge_access": "read_write" }}Now, you have successfully created a bucket and attributed read-write permissions to it. You can start storing and retrieving objects from this bucket.