Cloudfront for wizard¶
You can connect the Wallarm Edge node to Amazon CloudFront to inspect traffic in either synchronous or asynchronous mode - without blocking any requests.
Follow the steps below to set up the connection.
-
Download the provided code bundle for your platform.
-
Proceed to your AWS Console → Services → Lambda → Functions.
-
Select the
us-east-1
(N. Virginia) region which is required for Lambda@Edge functions. -
Create function with the following settings:
- Runtime: Python 3.x.
- Execution role: Create a new role from AWS policy templates → Basic Lambda@Edge permissions (for CloudFront trigger).
- Other settings can remain as default.
-
Once the function is created, on the Code tab, paste the Wallarm request processing code.
-
Update the following parameters in the code:
wlrm_node_addr
: your Wallarm node URL.wlrm_inline
: if using asynchronous (out-of-band) mode, set toFalse
.- If necessary, modify other parameters.
-
Proceed to Actions → Deploy to Lambda@Edge and specify the following settings:
- Configure new CloudFront trigger.
- Distribution: your CDN that routes traffic to the origin you want to protect.
- Cache behavior: the cache behavior for the Lambda function, typically
*
. -
CloudFront event:
- Origin request: executes the function only when CloudFront CDN requests data from the backend. If CDN returns a cached response, the function will not be executed.
- Viewer request: executes the function for every request to CloudFront CDN.
- Check Include body.
- Check Confirm deploy to Lambda@Edge.
-
Repeat the procedure for the Wallarm-provided response function, selecting responses as the trigger.
Ensure the response trigger matches the request trigger (origin response for origin request, viewer response for viewer request).