This hands-on lab gives you the opportunity to work with VPC Flow Logs. It will teach various ways to review VPC Flow Logs and monitor networks. A common way people evaluate VPC Flow Logs is by sending them to CloudWatch. Once they’re in CloudWatch, people can create metrics, then set alarms based on those metrics. Additionally, it’s possible to export CloudWatch Logs to S3. In fact, it’s possible to export VPC Flow Logs directly to S3. The advantages of this are cost savings and ease of use. In this hands-on lab, we will go through the process of exporting VPC Flow Logs to S3, as well as use Amazon Athena to query those Flow Logs.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create an S3 Bucket
- Navigate to S3.
- Click Create Bucket.
- Give the bucket a unique name (e.g., "vpcflow4learningactivity" and a series of numbers at the end, like the account ID of the AWS account provisioned with the lab, to make it globally unique).
- Click Next three times.
- Click Create Bucket.
- Click to open your newly created bucket.
- Click Create folder.
- In the box next to the folder, enter "AWSLogs".
- Click Save.
- Click Create folder.
- In the box next to the folder, enter "QueryResults".
- Click Save.
- Configure VPC Flow Logs
- Navigate to VPC > Your VPCs.
- Select the
LinuxAcademy
VPC. - Click Actions > Create flow log.
- Set the following values:
- Filter: All
- Destination: Send to an S3 bucket
- S3 bucket ARN:
arn:aws:s3:::<YOUR_BUCKET_NAME>
- Click Create.
- Click the Flow Logs tab to verify the flow log exists.
- Create and Query a Sample Table in Amazon Athena
- In Athena, specify the QueryResults folder in the S3 bucket as the query results location.
- Use the Athena tutorial to create a sample table.
- Run a
select * from
query on the table. - Edit the query by replacing
*
withrequest_ip
and run it again.
- Configure and Query the VPC Flow Logs
- In S3, verify that logs have populated the AWSLogs folder in the vpcflow4learningactivity bucket.
- In Athena, run the scripts provided on the lab page.