Check provider logo

EC2 instance is associated with an IAM instance profile role

ec2_instance_profile_attached

Severitymedium
Serviceec2
by Prowler

EC2 instances are evaluated for association with an IAM instance profile role that delivers temporary credentials to workloads running on the instance

Risk

Without an instance profile, apps often rely on long-term access keys on the host. Exposed keys can be used from anywhere to read data, alter resources, or disrupt services, impacting confidentiality, integrity, and availability. Keys may persist in AMIs, images, or logs, hindering rotation and amplifying blast radius.

Run this check with Prowler CLI

prowler aws --checks ec2_instance_profile_attached

Recommendation

Attach an IAM instance profile to every instance and grant only permissions each workload requires (least privilege). Eliminate static keys on hosts; use temporary credentials with automatic rotation. Separate roles per application, enforce separation of duties, and limit who can assign roles (govern via iam:PassRole). Monitor role usage for anomalies.

Remediation

CLI

aws ec2 associate-iam-instance-profile --instance-id <INSTANCE_ID> --iam-instance-profile Name=<INSTANCE_PROFILE_NAME>

Native IaC
Terraform
Other
  1. Open the AWS Management Console and go to EC2
  2. Select Instances and choose the target instance
  3. Click Actions > Security > Modify IAM role
  4. Select the IAM role (instance profile) to attach
  5. Click Update IAM role

Source Code

Resource Type

AwsEc2Instance

References