turbot/steampipe-mod-aws-compliance

Control: VPC flow logs should be enabled

Description

The VPC flow logs provide detailed records for information about the IP traffic going to and from network interfaces in your AWS Virtual Private Cloud (AWS VPC.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.vpc_flow_logs_enabled

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.vpc_flow_logs_enabled --share

SQL

This control uses a named query:

with vpcs as (
select
arn,
account_id,
region,
owner_id,
vpc_id,
tags,
_ctx
from
aws_vpc
order by
vpc_id
),
flowlogs as (
select
resource_id,
account_id,
region
from
aws_vpc_flow_log
order by
resource_id
)
select
v.arn as resource,
case
when v.account_id <> v.owner_id then 'skip'
when f.resource_id is not null then 'ok'
else 'alarm'
end as status,
case
when v.account_id <> v.owner_id then v.vpc_id || ' is a shared VPC.'
when f.resource_id is not null then v.vpc_id || ' flow logging enabled.'
else v.vpc_id || ' flow logging disabled.'
end as reason
, v.region, v.account_id
from
vpcs as v
left join flowlogs as f on v.vpc_id = f.resource_id;

Tags