Edge Application - Edge Functions Instances
Edge Functions module allows you to instantiate serverless functions in your Edge Application at Azion, as well as set up conditions for its execution.
Available for Edge Application and Edge Firewall products. Once it runs serverless functions in our robust distributed network of Edge Nodes, it responds to events closer to the end user, ensuring greater scalability and availability.
In this documentation, you will learn how to instantiate and execute the functions in your Edge Application.
Before you start adding Edge Functions to your Edge Application, consider the following:
Activating Edge Functions
The first step is to access your Edge Application and activate the Edge Functions module in Main Settings, as detailed below, in How to set up your Edge Functions.
This way, you can start using the functions provided by Azion, such as: A / B Testing; Massive Redirect; Hello World, Cookie Targeting, among others.
Instantiating an Edge Function
When instantiating an Edge Function, it is not possible to change its source code, just inform the arguments that will be passed to the context of the function’s execution, in JSON, through the Args tab.
Attention, the Args field in Edge Functions Instance supports a maximum of 100KB of arguments.
To associate an execution trigger, you simply need for the instance to be associated with a Behavior of a Rules Engine rule, in the Request or Response Phase. Thus, when a request meets the criteria defined in the Rules Engine rules, the Edge Function will be invoked and executed directly on Azion’s Edge Nodes.
To learn more about how they work and how to apply some of these Edge Functions, visit our Use Cases.
2. How to set up your Edge Functions?
Follow these steps to instantiate and execute the functions in your Edge Application:
- From the Real-Time Manager, access the Edge Applications menu.
- Select one Edge Application.
- In the Main Settings tab, activate the Edge Functions module.
- In the Functions tab, click Add function to instantiate the function among the options.
- Still in Functions, select the Args tab, and fill in the required information.
- Click the Save button and you will have instantiated your Edge Function.
- Then, select the Rules Engine tab and add a rule in the Request or Response Phase.
- When creating your rule, choose Run Function in Behavior.
- Click the Save button and your function will be executed when there is an HTTP request.
Access the Real-Time Metrics to follow the invocations and get real-time information about the performance of your Edge Functions.
3. Related documentation
Didn’t find what you were looking for? Open a ticket.