How to upload an object to an Edge Storage bucket
This guide walks you through uploading an object to an Edge Storage bucket using the Azion API, Azion CLI, and Azion Runtime.
Uploading an object to a bucket
To upload an object, run the following POST
request in your terminal, replacing [TOKEN VALUE]
with your personal token, <bucket_name>
with the name of your bucket, <object_key>
with an ID or name for the object, the Content-Type
header with the MIME type being submitted, and the object sent as a data binary:
curl --location 'https://api.azion.com/v4/storage/buckets/<bucket_name>/objects/<object_key>' \
--header 'Accept: application/json; version=3' \
--header 'Content-Type: text/csv' \
--header 'Authorization: Token [TOKEN VALUE]' \
--data '@./path/file.csv'
You should receive the following response:
{ "state": "executed", "data": { "object_key": "folder/csv-file" }
}
Requirements
To upload an object to an Edge Storage bucket:
You can create an edge function to upload objects to your bucket using a POST
console command and see if an object is available using a GET
console command. To do so:
- Access Azion Console > Edge Functions.
- Click the + Edge Function button.
- Name your function. Example:
my-bucket POST
. - In the Code tab, add the following JavaScript code:
- Click the Save button.
Once you have the edge function ready, you need to create an edge application that will proxy the upload process for the bucket and instantiate the edge function.
Go to Edge Application first stepsGo to how to instantiate an edge function