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_attachedSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.ec2_instance_publicly_accessible_iam_profile_attached --shareSQL
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_idfrom aws_ec2_instancewhere public_ip_address is not null;