Skip to main content
Version: 4.6.1-saas

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

  1. Go to NetFUNNEL console
  2. Click the profile icon in the top right
  3. Select Integration Credentials menu
  4. Copy Client ID

Step 2: Create IAM Role

  1. AWS IAM console → Click [Roles]
  2. Click [Create role]
  3. Trusted entity: Select AWS service
  4. Use case: Select Lambda
  5. Click [Next: Permissions]

Configure Trust Entity

  1. After creating the role, click [Trust Entity] tab
  2. 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

  1. Click [Permissions] tab
  2. [Add permissions] → Click [Create inline policy]
  3. 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

  1. Go to Lambda console in us-east-1 region (required)
  2. Click [Create function]
  3. Select [Author from scratch]
  4. Enter function name (e.g., "netfunnel-agent")
  5. Runtime: Select Node.js
  6. Select the IAM role created above
  7. Click [Create function]

Configure Lambda Function

  1. Download netfunnel-cloudfront-agent.js file from https://agent-lib.stclab.com/agents/cdn/cloudfront/netfunnel-cloudfront-agent-latest.js
  2. Upload netfunnel-cloudfront-agent.js file to code source in [Code] tab
  3. Open index.mjs file 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)
};
  1. Create package.json file and paste the following code:
{
"name": "cloudfront-agent",
"type": "module",
"dependencies": {}
}
  1. Click [Deploy] button
  2. [Versions] tab → Click [Publish new version]

Step 4: CloudFront Configuration

Connect Lambda@Edge

  1. Select CloudFront Distribution to apply Lambda@Edge
  2. Select an item in [Behaviors] tab and click [Edit]
  3. 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)
  4. Click [Save changes]

CloudFront Invalidation

  1. Click [Invalidations] tab
  2. Click [Create invalidation]
  3. Object paths: Enter /*
  4. Click [Create invalidation]
  5. Lambda@Edge connection will be applied after invalidation is complete

Next Steps