Description
VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. After you've created a flow log, you can view and retrieve its data in Amazon CloudWatch Logs. It is recommended that VPC Flow Logs be enabled for packet "Rejects" for VPCs.
Rationaleβ
VPC Flow Logs provide visibility into network traffic that traverses the VPC and can be used to detect anomalous traffic or insight during security workflows.
Impactβ
By default, CloudWatch Logs will store Logs indefinitely unless a specific retention period is defined for the log group. When choosing the number of days to retain, keep in mind the average days it takes an organization to realize they have been breached is 210 days (at the time of this writing). Since additional time is required to research a breach, a minimum 365 day retention policy allows time for detection and research. You may also wish to archive the logs to a cheaper storage service rather than simply deleting them. See the following AWS resource to manage CloudWatch Logs retention periods:
Auditβ
Perform the following to determine if VPC Flow logs are enabled:
From Consoleβ
- Sign into the management console.
- Select
Services
thenVPC
. - In the left navigation pane, select
Your VPCs
. - Select a VPC.
- In the right pane, select the
Flow Logs
tab. - Ensure a Log Flow exists that has
Active
in theStatus
column.
From Command Lineβ
- Run
describe-vpcs
command (OSX/Linux/UNIX) to list the VPC networks available in the current AWS region:
aws ec2 describe-vpcs --region <region> --query Vpcs[].VpcId
- The command output returns the
VpcId
available in the selected region. - Run
describe-flow-logs
command (OSX/Linux/UNIX) using the VPC ID to determine if the selected virtual network has the Flow Logs feature enabled:
aws ec2 describe-flow-logs --filter "Name=resource-id,Values=<vpc-id>"
- If there are no Flow Logs created for the selected VPC, the command output will return an
empty list []
. - Repeat step 3 for other VPCs available in the same region.
- Change the region by updating
--region
and repeat steps 1 - 5 for all the VPCs.