Workloads quickstart
Create a workload, bind your application to it with a deployment, and send your first request through its workload domain.
This guide instructs you through serving your application from your first workload.
- Create a workload on the production infrastructure.
- Bind the application you already have to the workload through its deployment.
- Send a request to the workload domain and get your application’s response.
Four objects carry a request to your application, and each one links to the next:
- The workload receives the traffic. Azion gives it a workload domain, a hostname of the form
<id>.map.azionedge.net. The workload answers on it before you own or point any domain. - The deployment of the workload names the application that answers. A workload holds one deployment.
- The application handles the request. It already exists, and the workload adds nothing to it.
- The request to the workload domain reaches the workload, and the deployment sends it to your application.
A workload with no deployment has no application to send a request to. An application serves no traffic until a deployment binds it to a workload. This guide keeps the defaults of a new workload: the production infrastructure, the default TLS settings, ports 80 and 443, and no domain of your own.
The workload this guide leaves you with is the starting point for two more quickstarts. With Certificate Manager, you bind a certificate to the workload. With Custom Pages, you assign a custom page set in the workload’s deployment to replace error responses. DDoS Protection needs no setup: the Platform mitigates DDoS attacks on every workload.
Select the interface you use. The prerequisites and every stage on this page follow that choice.
Prerequisites
- An Azion account. To create one, refer to Create an account.
- An application that serves content. To create one, refer to Applications quickstart.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
Create the workload
A new workload runs on the production infrastructure and answers on its workload domain. The infrastructure is fixed once the workload exists. A workload created on staging cannot move to production later. The workload domain stays reachable while Workload Domain Allow Access is on, which is the default.
To create the workload with the Azion CLI:
The command prints the ID of the new workload:
Read the workload back in JSON. Replace <workload-id> with the ID from the previous command:
The output shows the defaults of a new workload and the workload domain Azion assigned to it:
infrastructure set to 1 is the production infrastructure, and domains is empty. Record the id for the deployment and the workload_domain for the request. The workload exists, and it has no deployment yet.
Bind your application
The deployment of a workload names the application that answers its requests, and optionally a firewall and a custom page set. A workload holds one deployment, and a second one is refused. Until the deployment names your application, the workload has nothing to send a request to.
To bind the application with the Azion CLI, create the deployment of the workload. Replace <workload-id> and <application-id>:
The command prints the ID of the new deployment:
--current true makes it the deployment the workload runs. List the deployment with its bindings:
The output shows your application, and 0 for no firewall:
The current deployment of the workload names your application. The Azion CLI cannot change a deployment after it exists. Check the application ID before you run the command.
Send a request to the workload domain
The check is the same whichever interface created the workload. In the commands, replace <your-workload-domain> with the workload domain of the workload you created, of the form <id>.map.azionedge.net.
A new workload does not answer at once. Its deployment spreads across Azion’s distributed infrastructure, and that takes several minutes, with no guaranteed duration. Until then, the workload domain answers 404 with Azion’s HTML error page. While the deployment spreads, answers to the same request can alternate between that 404 and your application’s response. Repeat the request until your application answers. For more information, refer to Propagation.
Before the deployment propagates, a header-only request gets Azion’s error page:
The x-azion-request-id header identifies the request. Once the deployment answers, send a request to the root path of your workload domain:
The response is the one your application returns for /: its status, its headers, and its body. Your workload serves your application on its workload domain.