Difference between revisions of "Create script for AWS Lambda to migrate old VPC flow logs"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
Line 28: Line 28:
 
<br />&nbsp;&nbsp;&nbsp;&nbsp;[[File:author_from_scratch.png|700px]]
 
<br />&nbsp;&nbsp;&nbsp;&nbsp;[[File:author_from_scratch.png|700px]]
  
 +
&nbsp;&nbsp;&nbsp;&nbsp; '''a.''' In the '''Name''' field, enter the designation of your '''Lambda''' (for example, ''MigrateOldVPCFlowLogs'')
  
 +
 
=  Configure the AWS '''Lambda''' function =
 
=  Configure the AWS '''Lambda''' function =

Revision as of 19:21, 17 April 2024

Contents


This procedure makes use of a JS script and the AWS Lambda service to automatically migrate data from your live bucket (the one that collects your VPC flow logs) to an archive bucket (a bucket that will receive the old flow files using the script).

This script will let you move or delete old VPC flow logs as required by your organization. To do this, you will use an AWS Lambda script with the Node.js 16 JavaScript engine.

You will then set this script to run every hour using the instructions below. If you have more than 1000 new flow logs pre hour, then you may want to increase this execution rate, as only 1000 files will be processed in each run.

Before you proceed make sure that you have the correct AWS permissions to perform the following actions:

  • Create Lambdas.
  • Access S3 buckets.
  • Change the Lambda execution policies.

You will also need to create an S3 bucket to receive the archived flow logs.

Create the AWS Lambda function

1. Login to the AWS portal.

2. Search for the Lambda service and click the related result.
    Search lambda.png


3. In the upper-right corner of the Lambda>Functions page, click the Create function button.
    Lambda functions.png
    The Create function page shows.

4. Select the Author from scratch option.
    Author from scratch.png

     a. In the Name field, enter the designation of your Lambda (for example, MigrateOldVPCFlowLogs)


Configure the AWS Lambda function