turbot/steampipe-mod-aws-compliance

Control: VPC internet gateways should be attached to authorized vpc

Description

Manage access to resources in the AWS Cloud by ensuring that internet gateways are only attached to authorized AWS Virtual Private Cloud (AWS VPC).

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.vpc_igw_attached_to_authorized_vpc

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
'arn:' || partition || ':ec2:' || region || ':' || account_id || ':internet-gateway/' || title as resource,
case
when jsonb_array_length(attachments) = 0 then 'alarm'
else 'ok'
end as status,
case
when jsonb_array_length(attachments) = 0 then title || ' not attached to VPC.'
else title || ' attached to ' || split_part(
substring(attachments :: text, 3, length(attachments :: text) -6),
'"VpcId": "',
2
) || '.'
end as reason
, region, account_id
from
aws_vpc_internet_gateway;

Tags