How to use an Edge Storage bucket as the origin of a static edge application
This guide walks you through setting a bucket as origin of an edge application using the Azion API, Azion CLI, and Azion Runtime.
Go to Edge Storage referenceThere are separate instructions for API v3 using legacy Origin settings and API v4 using the new Edge Connector product.
Create a bucket and upload files
This section describes how you can upload objects to a bucket and maintain project structure using the Azion API. In this scenario, you’ll create a static application using two files, distributed into folders as follows:
src/index.htmlsrc/styles/style.css
- Create the following
index.html
file inside of a localsrc
directory:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="styles/style.css"></head><body> <h1>Hello world!</h1> <p>I am an object from a bucket.</p></body></html>
- Now create the
style.css
file, which is referenced in the HTML, under thestyles
folder in the same directory:
body {background-color: black;}
h1, p { color: #F3652B;}
- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token and writing the desired bucket name inname
to create a 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": "app-origin", "edge_access": "read_only"}'
- You should receive the following response:
{"state": "executed","data": { "name": "app-origin", "edge_access": "read_only"}}
-
Run the following
POST
requests in your terminal for each file, replacing<bucket_name>
with the name of the bucket you just created:- For the
index.html
file, run the following command usingsrc/index.html
as the object key, and adding the object path as data:
- For the
curl --location 'https://api.azion.com/v4/storage/buckets/<bucket_name>/objects/src/index.html' --header 'Accept: application/json;' --header 'Content-Type: text/html' --header 'Authorization: Token [TOKEN VALUE]' --data '@./src/index.html'
- For the
styles.css
file, run the following command usingsrc/styles/style.css
as the object key, and adding the object path as data:
curl --location 'https://api.azion.com/v4/storage/buckets/<bucket_name>/objects/src/styles/style.css' --header 'Accept: application/json;' --header 'Content-Type: text/css' --header 'Authorization: Token [TOKEN VALUE]' --data '@./src/styles/style.css'
- You should receive the following responses for the files:
{ "state": "executed", "data": { "object_key": "src/index.html" }}
{ "state": "executed", "data": { "object_key": "src/styles/style.css" }}
Create an edge application and set origin type to Edge Storage
Now that your bucket is populated with files, you can create a new edge application and a domain to set the bucket as the origin of the content and serve these objects.
To facilitate this process, use the Edge Application Proxy template:
- Access Azion Console.
- If you don’t have an account yet, create a new one by visiting the sign-up page.
- On the homepage, select the + Create option.
- Find the Edge Application Proxy card in the templates section and select it.
- Give your application an easy-to-remember name.
- In Route to bypass, type
/
to specify the root path of the application. - Wait for the deployment process to finish.
- Copy the domain of the application, in the format
http://xxxxxxxxxx.map.azionedge.net/
.
Now you need to configure a new Edge Connector to link your application to your Edge Storage bucket. To do so:
- Access Azion Console > Edge Connector.
- Click the + Edge Connector button.
- In the General section, give your connector a unique and descriptive name (e.g.,
My Edge Storage Connector
). - In the Connector Type section, select Edge Storage.
- In the Connection Options section:
- For Bucket, select the name of the bucket you created in the previous steps.
- For Prefix, enter
/src
(or the prefix you used when uploading your objects).
- Set the Status to Active.
- Click the Save button.
To activate the Edge Connector in your edge application:
- Access the Rules Engine tab.
- Edit the default rule or add a new request rule.
- In the Criteria section, to apply the Edge Connector for your whole application, set the criteria to
If ${uri} starts with /
. - In the Behavior section, select the Set Edge Connector behavior.
- Select the Edge Connector you want to apply.
- Click the Save button.
- Wait some time for the changes to propagate to the edge.
Once the changes have been made, access http://xxxxxxxxxx.map.azionedge.net/index.html
to see the HTML file you uploaded with the applied CSS style.
To facilitate this process, use the Edge Application Proxy template:
- Access Azion Console.
- If you don’t have an account yet, create a new one by visiting the sign-up page.
- On the homepage, select the + Create option.
- Find the Edge Application Proxy card in the templates section and select it.
- Give your application an easy-to-remember name.
- In Origin Address, type
httpbin.org
.- This is a temporary origin that will later be replaced with an Edge Storage origin.
- In Route to bypass, type
/
to specify the root path of the application. - Wait for the deployment process to finish.
- Copy the domain of the application, in the format
http://xxxxxxxxxx.map.azionedge.net/
.
Now you need to configure a new Edge Storage origin and determine that your application should retrieve content from the bucket and prefix you created. To do so:
- Access Azion Console > Edge Application.
- Click the proxy application you created in the previous steps.
- Navigate to the Origins tab.
- Click the + Origin button.
- Give your origin an easy-to-remember name.
- In Origin Type, select Edge Storage.
- In Bucket Name, add the name of the bucket you created in the previous steps.
- In Prefix, add
/src
, which is the prefix you added to the object keys uploaded previously. - Click the Save button.
To activate the origin in your edge application:
- Navigate to the Rules Engine tab.
- Select the Default Rule.
- Under Behaviors, in the Set Origin behavior, replace the Default Origin with the origin you created for your bucket.
- Click the Save button.
- Wait some time for the changes to propagate to the edge.
Once the changes have been made, access http://xxxxxxxxxx.map.azionedge.net/index.html
to see the HTML file you uploaded with the applied CSS style.
Requirements
To create an edge application with the necessary configurations to use a bucket as origin:
azion create edge-application --name "edge storage app" --delivery-protocol "http" --http3 false --origin-type "single_origin" --address "httpbin.org" --origin-protocol-policy "preserve" --host-header "${host}" --browser-cache-settings "honor" --browser-cache-settings-maximum-ttl 0 --cdn-cache-settings "override" --cdn-cache-settings-maximum-ttl 0
- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token:
curl --location 'https://api.azionapi.net/edge_applications' --header 'Accept: application/json;' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{ "name": "edge storage app", "delivery_protocol": "http", "http3": false, "origin_type": "single_origin", "address": "httpbin.org", "origin_protocol_policy": "preserve", "host_header": "${host}", "browser_cache_settings": "honor", "browser_cache_settings_maximum_ttl": 0, "cdn_cache_settings": "override", "cdn_cache_settings_maximum_ttl": 0}'
- You should receive a response similar to:
{ "results": { "id": "<edge_application_id>", "name": "edge storage app", "delivery_protocol": "http" ... }, "schema_version": 3}
- Copy the value from the
edge_application_id
field and paste it in a text editing app to save it for later requests. - Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token and<edge_application_id>
with the ID of the edge application you created:
curl --location 'https://api.azionapi.net/domains' --header 'Accept: application/json;' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{ "name": "edge storage domain", "cname_access_only": false, "digital_certificate_id": null, "edge_application_id": "<edge_application_id>"}'
- You should receive a response similar to:
{ "results": { "id": "<domain_id>", "name": "edge storage domain", ... "edge_application_id": "<edge_application_id>", "is_active": true, "domain_name": "xxxxxxxxxx.map.azionedge.net", ... }, "schema_version": 3}
- Copy the URL in the
domain_name
value and paste it in a text editing app to access later. - Run the following
POST
request to create an edge storage origin for the application, replacing[TOKEN VALUE]
with your personal token,<edge_application_id>
with the ID of the edge application, and the value ofbucket
with the name of the bucket you created:
curl --location 'https://api.azionapi.net/edge_applications/<edge_application_id>/origins' --header 'Accept: application/json;' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{ "name": "edge storage origin", "origin_type": "object_storage", "bucket": "app-origin", "prefix": "/src"}'
- You should receive a response similar to:
{"results": { "origin_id": "<origin_id>", "origin_key": "bdcd7003-ba53-4ed8-8ca0-05b1357cdafd", "name": "New Edge Storage origin", "origin_type": "object_storage", ... "bucket": "new-bucket-rw", "prefix": "/"},"schema_version": 3}
- Copy the value from the
origin_id
field and paste it in a text editing app to save it for later requests. - Run the following
GET
request in your terminal to retrieve the ID of the default rule of your edge application’s Rules Engine, replacing<edge_application_id>
variable with the edge application ID you copied previously:
curl --location 'https://api.azionapi.net/edge_applications/<edge_application_id>/rules_engine/request/rules' --header 'Accept: application/json;' --header 'Authorization: Token [TOKEN VALUE]'
- You should receive a response similar to:
{ ... "results": [ { "id": "<rule_id>", "name": "Default Rule", "phase": "default", "behaviors": [ { "name": "set_origin", "target": "<origin_id>" }, { "name": "set_cache_policy", "target": "<cache_setting_id>" } ], ... "description": "" } ]}
- Copy the value from the
rule_id
field and paste it in a text editing app to save it for later requests. - Run the following
PATCH
request to modify the default rule, replacing<rule_id>
with the ID of the rule you retrieved in the previous step, leaving theset_cache_policy
object the same as received in the response:
curl --location --request PATCH 'https://api.azionapi.net/edge_applications/<edge_application_id>/rules_engine/request/rules/<rule_id>' --header 'Accept: application/json;' --header 'Content-Type: application/json' --header 'Authorization: Token [TOKEN VALUE]' --data '{ "behaviors": [ { "name": "set_origin", "target": "<origin_id>" }, { "name": "set_cache_policy", "target": "<cache_setting_id>" } ]}'
- Wait some time for the changes to propagate.
Once the changes have been made, access the domain you created, in the format http://xxxxxxxxxx.map.azionedge.net/index.html
, to see the HTML file you uploaded with the applied CSS style.
- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token:
curl --request POST --url https://api.azion.com/v4/edge_application/applications --header 'Accept: application/json' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{"name": "edge storage app","modules": { "edge_cache": { "enabled": true }, "edge_functions": { "enabled": true }, "application_accelerator": { "enabled": false }, "image_processor": { "enabled": false }, "tiered_cache": { "enabled": false }},"active": true,"debug": false}'
- You should receive a response similar to:
{"state": "pending","data": { "id": "edge_application_id", "name": "edge storage app", "last_editor": "education1@azion.com", "last_modified": "2025-07-25T19:06:13.854005Z", "modules": { "edge_cache": { "enabled": true }, "edge_functions": { "enabled": true }, "application_accelerator": { "enabled": false }, "image_processor": { "enabled": false }, "tiered_cache": { "enabled": false } }, "active": true, "debug": false, "product_version": "3.0"}}
-
Copy the value from the
edge_application_id
field and paste it in a text editing app to save it for later requests. -
Run the following
POST
request in your terminal to create an Edge Connector, replacing[TOKEN VALUE]
with your personal token
curl --request POST --url https://api.azion.com/v4/edge_connector/connectors --header 'Accept: application/json' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{"name": "edge storage connector","active": true,"type": "edge_storage","attributes": { "bucket": "app-origin", "prefix": "/"}}'
-
Copy the value from the
<edge_connector_id>
field and paste it in a text editing app to save it for later requests. -
You should receive a response similar to:
{"id": "<edge_connector_id>","name": "edge storage connector","last_editor": "your-email@example.com","last_modified": "2025-07-22T14:34:31.009649Z","active": true,"product_version": "1.0","type": "edge_storage","attributes": { "bucket": "app-origin", "prefix": "/"}}
- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token
curl --request POST --url https://api.azion.com/v4/workspace/workloads --header 'Accept: application/json' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{"name": "edge storage domain","active": true,"infrastructure": 1,"protocols": { "http": { "versions": [ "http1", "http2" ] }},"workload_domain_allow_access": true}'
- You should receive a response similar to:
{"state": "pending","data": { "id": "workload_id", "name": "edge storage domain", "active": true, "last_editor": "your-email@example.com", "last_modified": "2025-07-25T18:58:25.817955Z", "infrastructure": 1, "tls": { "certificate": null, "ciphers": 7, "minimum_version": "tls_1_3" }, "protocols": { "http": { "versions": [ "http1", "http2" ], "http_ports": [ 80 ], "https_ports": [ 443 ], "quic_ports": null } }, "mtls": { "verification": null, "certificate": null, "crl": null }, "domains": [], "workload_domain_allow_access": true, "workload_domain": "xxxxxxxxxxx.azionedge.net", "product_version": "1.0"}}
-
Copy the URL in the
workload_domain
value and paste it in a text editing app to access later. -
Run the following
POST
request to bind the Workload to your Edge Application, replacing[TOKEN VALUE]
with your personal token,<edge_application_id>
with the ID of the edge application and<workload_id>
with the id of the Workload.
curl --request POST --url https://api.azion.com/v4/workspace/workloads/<workload_id>/deployments --header 'Accept: application/json' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{"name": "Edge Storage App","current": true,"active": true,"strategy": { "type": "default", "attributes": { "edge_application": "<edge_application_id>" }}}'
- Run the following
POST
request in your terminal to create a Rules Engine rule, replacing<edge_application_id>
variable with the Edge Application ID and<edge_connector_id>
with the Edge Connector ID you copied previously:
curl --request POST --url https://api.azion.com/v4/edge_application/applications/<edge_application_id>/request_rules --header 'Accept: application/json' --header 'Authorization: Token [TOKEN VALUE]' --header 'Content-Type: application/json' --data '{"name": "string","active": true,"criteria": [ { "conditional": "if", "variable": "${uri}", "operator": "starts_with", "argument": "/" } ]],"behaviors": [ { "type": "set_edge_connector", "attributes": { "value": "<edge_connector_id>" } }]}'
- You should receive a response similar to:
{"state": "pending","data": { "id": "<rule_id>", "name": "string", "active": true, "criteria": [ [ { "conditional": "if", "variable": "${uri}", "operator": "starts_with", "argument": "/" } ] ], "behaviors": [ { "type": "set_edge_connector", "attributes": { "value": "<edge_connector_id>" } } ], "description": "", "order": 1, "last_editor": "your-email@example.com", "last_modified": "2025-07-25T19:29:30.684210Z"}}
- Wait some time for the changes to propagate.
Once the changes have been made, access the domain you created, in the format http://xxxxxxxxxx.map.azionedge.net/index.html
, to see the HTML file you uploaded with the applied CSS style.
Learn how to use an Edge Storage bucket as the origin of a static edge application. Watch the video below: