How to create and modify an Edge Storage bucket

Azion Edge Storage allows you to create buckets and integrate your object storage with your edge infrastructure. This guide covers how to create, modify, and delete a bucket using the Azion API.

Go to Edge Storage reference

Read How to upload and download objects from an Edge Storage bucket to learn about object operations.


Creating a read-only bucket via API

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:

Terminal window
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"
}
}

Now you can use the bucket name to upload and download objects from the bucket.


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:

Terminal window
curl --location '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"
}
}

Removing bucket

Run the following DELETE request in your terminal, replacing [TOKEN VALUE] with your personal token and bucket_name with the name of the bucket you want to delete:

Terminal window
curl --location --request DELETE 'https://api.azion.com/v4/storage/buckets/<bucket_name>' \
--header 'Accept: application/json' \
--header 'Authorization: Token [TOKEN VALUE]'

Contributors