Update Lambda@Edge
🔵 POST - Update Lambda@Edge
Update Lambda@Edge
Update the Lambda@Edge function with new bot patterns and propagate to all CloudFront distributions
POST
Update Lambda@Edge
Update the Lambda@Edge function with new bot patterns and propagate to all CloudFront distributions.
When to Use
Call this endpoint when you’ve updated the bot detection patterns inlambda_code.js and want to deploy the changes to all customer domains.
Common reasons to update:
- New AI bot released (e.g., new Anthropic crawler)
- Bot User-Agent pattern changed
- Bug fix in routing logic
What This Does
- Uploads new Lambda code from
lambda_code.js - Publishes a new Lambda version (e.g.,
:1→:2) - Updates all CloudFront distributions to use the new version (parallel batches)
Timing
| Step | Duration |
|---|---|
| Lambda upload | ~5 seconds |
| Version publish | ~5 seconds |
| Distribution updates | ~1 minute per 100 distributions |
| Total for 1,000 distributions | ~15 minutes |
Customer Impact
Zero downtime. CloudFront updates are rolling:- Old Lambda version continues handling requests
- Traffic gradually shifts to new version
- No interruption to customer websites
Authentication
This endpoint requires an internal API key. Include theX-API-Key header:
Example Request
Example Response
Response Fields
| Field | Type | Description |
|---|---|---|
| status | string | success or error |
| lambda_arn | string | New Lambda version ARN |
| distributions.total | number | Total distributions to update |
| distributions.successful | number | Successfully updated |
| distributions.failed | number | Failed to update |
| distributions.failed_details | array | Details of any failures |
Workflow
Step 1: Update Bot Patterns
EditBackend/src/app/domain/setup_proxy/step_0_lambda_setup/lambda_code.js:
Step 2: Deploy Changes
Step 3: Verify
The response shows how many distributions were updated. All customer domains will now detect the new bot patterns.Rate Limiting
The endpoint processes distributions in batches of 10 with a 1-second delay between batches to respect AWS CloudFront API limits.Error Handling
If some distributions fail to update:- Successfully updated distributions use the new Lambda
- Failed distributions continue using the old Lambda (still works)
- Retry the endpoint to attempt failed distributions again