How to create an Edge Storage bucket

This guide shows how to use Azion Edge Storage service to create a read-only bucket and assign read-write permissions using the Azion API.

Creating a bucket

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; version=3' \
--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

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; version=3' \
--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.


Contributors