turbot/steampipe-mod-aws-compliance

Control: Public EC2 instances should have IAM profile attached

Description

Ensure AWS Elastic Compute Cloud (AWS EC2) public instances have an Identity and Access Management (IAM) profile attached to them. This rule is non-compliant if no IAM profile is attached to a public AWS EC2 instance.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.ec2_instance_publicly_accessible_iam_profile_attached

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
arn as resource,
case
when iam_instance_profile_id is not null then 'ok'
else 'alarm'
end as status,
case
when iam_instance_profile_id is not null then title || ' IAM profile attached.'
else title || ' IAM profile not attached.'
end as reason
, region, account_id
from
aws_ec2_instance
where
public_ip_address is not null;

Tags