Hosting an Edge Site

Azion’s Edge Computing platform has serverless functions that enable Edge Websites to be created and all processing done directly on our Edge Nodes, without having to access any origin infrastructure.

With the Edge Function, Hello World, you can create error or status pages that you can use to monitor and report on the status of a particular service, in real time, directly on the Edge, so that availability is high and latency low.

Combined with Azion’s Data Stream service, the client can send records of the accesses made to the Edge Website to their SIEM (Security information and Event Management), Big Data or log servers, and carry out analysis of the data collected.

Some other advantages of using the Edge Function, Hello World:

  • Gives the client flexibility when developing applications;
  • Edge Websites are processed through a distributed Edge Nodes infrastructure; and
  • The option to run business rules on the Edge.

How it works

It is very simple to use: Just install a Hello World function within your Edge Application and configure the desired response through the parameters of the function (Args). When a request reaches the Edge, the validation criteria are assessed, and, if all requirements are met, the function will be run.

Next, in order to show how an Edge Website in Azion works, we have an example where you want to display a status page with a service temporarily unavailable notice (‘www.myapplication.com/api_service’, for example), created by using the Hello World Edge Function.

Configuring the Hello World function

Edge Function Hello World is available from the function library of Azion’s Edge Computing platform and can be accessed through Azion Console, from the Libraries menu.

To run the function, it must be installed in the relevant Edge Application and its activation criteria and behaviors must be defined within the Rules Engine.

Creating an Instance

Path: Azion Console > Edge Computing > Edge Applications > Sua Edge Application (Your Edge Application) > Functions.

From the Azion Console, go to the Edge Application that will run your function and, within the Functions tab, add a new function and give it a distinctive name (MyHelloWorld, to illustrate our example).

Parameters: it is necessary to select which function to use for your instance; in this case, choose the Hello World option, in the “Edge Function” field. Note that the function code that appears in the Code field, is just for information. On the Args tab, enter the HTTP code and the desired response message - see example below - and save the function.

{
"param":{
"http_status": 503,
"body": "We are working hard to serve you better!"
}
}

Example of the configuration of JSON Args parameters

Defining the Execution criteria (Rules Engine)

Path: Azion Console > Edge Computing > Edge Applications > Sua Edge Application (Your Edge Application) > Rules Engine.

The rules (as defined in the Rules Engine) determine the set of conditions that need to be met for Behaviors to be executed. You can either use the Default Rule or create a new rule after setting the validation parameters and the behaviors that the Edge Application will execute.

Defining validation Criteria: choose the variables, comparison operators and strings to create your business rule, as in the following example:

  • If: ${uri} starts with /api_service (In order: logical operator, variable, comparison operator, string)

Here, the rule is executed if the URL accessed starts with the string “/api_service”.

Defining Behaviors: add the behaviors you want to be carried out when the rule’s conditions are met. For Example:

  • Then: Run Function MyHelloWorld (In order: logical operator, action, function)

In this example, if the conditions defined in the rules are satisfied, then the function MyHelloWorld will be run. Therefore, when the user accesses the URL “www.myapplication.com/api_service”, the function will run, and the message will be displayed as set.

Finally, save your Edge Application and the new function will be ready.


Contributors