Quick Start
Get started with NetFUNNEL 4 CloudFront Agent in 5-10 minutes with this quick start guide.
Prerequisites
- NetFUNNEL console access
- AWS account with Lambda@Edge support
- Permissions to create and manage CloudFront Distribution
- Permissions to create IAM roles and attach policies
Step 1: Get Client ID
- Go to NetFUNNEL console
- Click the profile icon in the top right
- Select
Integration Credentialsmenu - Copy
Client ID
Step 2: Create IAM Role
- AWS IAM console → Click [Roles]
- Click [Create role]
- Trusted entity: Select AWS service
- Use case: Select Lambda
- Click [Next: Permissions]
Configure Trust Entity
- After creating the role, click [Trust Entity] tab
- Edit Trust Entity and paste the following JSON:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"edgelambda.amazonaws.com",
"lambda.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}
Attach Policy
- Click [Permissions] tab
- [Add permissions] → Click [Create inline policy]
- Paste the following policy in the JSON tab:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}
Step 3: Create Lambda Function
Create Lambda Function
- Go to Lambda console in us-east-1 region (required)
- Click [Create function]
- Select [Author from scratch]
- Enter function name (e.g., "netfunnel-agent")
- Runtime: Select Node.js
- Select the IAM role created above
- Click [Create function]
Configure Lambda Function
- Download
netfunnel-cloudfront-agent.jsfile from https://agent-lib.stclab.com/agents/cdn/cloudfront/netfunnel-cloudfront-agent-latest.js - Upload
netfunnel-cloudfront-agent.jsfile to code source in [Code] tab - Open
index.mjsfile and write the following code:
import handleEvent from './netfunnel-cloudfront-agent.js';
const config = {
clientID: "{{CLIENT_ID}}",
}
export const handler = async (event) => {
return await handleEvent(event, config)
};
- Create
package.jsonfile and paste the following code:
{
"name": "cloudfront-agent",
"type": "module",
"dependencies": {}
}
- Click [Deploy] button
- [Versions] tab → Click [Publish new version]
Step 4: CloudFront Configuration
Connect Lambda@Edge
- Select CloudFront Distribution to apply Lambda@Edge
- Select an item in [Behaviors] tab and click [Edit]
- In Function associations at the bottom:
- Viewer request: Enter the created Lambda function ARN (including version, e.g.,
:1) - Viewer response: Enter the created Lambda function ARN (including version, e.g.,
:1)
- Viewer request: Enter the created Lambda function ARN (including version, e.g.,
- Click [Save changes]
CloudFront Invalidation
- Click [Invalidations] tab
- Click [Create invalidation]
- Object paths: Enter
/* - Click [Create invalidation]
- Lambda@Edge connection will be applied after invalidation is complete
Next Steps
- Installation and Initialization: Detailed configuration guide
- Initialization Settings: Lambda config and additional feature configuration