๐ก๏ธ AWS EC2 Instance IAM role is not attached๐ข
- Contextual name: ๐ก๏ธ Instance IAM role is not attached๐ข
- ID:
/ce/ca/aws/ec2/instance-iam-role - Tags:
- ๐ข Policy with categories
- ๐ข Policy with type
- ๐ข Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicโ
- ๐ง prod.logic.yaml๐ข
Similar Policiesโ
- Cloud Conformity: EC2 Instance Using IAM Roles
- Internal:
dec-x-6c93750d
Similar Internal Rulesโ
| Rule | Policies | Flags |
|---|---|---|
| โ๏ธ dec-x-6c93750d | 1 |
Descriptionโ
Descriptionโ
AWS access from within AWS instances can be done by either encoding AWS keys into AWS API calls or by assigning the instance to a role that has an appropriate permissions policy for the required access. "AWS Access" means accessing AWS APIs to access AWS resources or manage AWS account resources.
Rationaleโ
AWS IAM roles reduce the risks associated with sharing and rotating credentials that can be used outside of AWS itself. If credentials are compromised, they can be used from outside of the AWS account they give access to. In contrast, in order to leverage role permissions an attacker would need to gain and maintain access to a specific instance to use the privileges associated with it.
Additionally, if credentials are encoded into compiled applications or other hard-to-change mechanisms, they are even less likely to be properly rotated due to service disruption risks. Over time, credentials that cannot be rotated are more likely to be known by an increasing number of individuals who no longer work for the organization.
... see more
Remediationโ
Remediationโ
From Consoleโ
- Sign in to the AWS Management Console and navigate to EC2 dashboard at https://console.aws.amazon.com/ec2/.
- In the left navigation panel, choose
Instances.- Select the EC2 instance you want to modify.
- Click
Actions.- Click
Security.- Click
Modify IAM role.- Click
Create new IAM roleif a new IAM role is required.- Select the IAM role you want to attach to your instance in the
IAM roledropdown.- Click
Update IAM role.- Repeat steps 3 to 9 for each EC2 instance in your AWS account that requires an IAM role to be attached.
From Command Lineโ
Run the
describe-instancescommand to list all EC2 instance IDs in the selected AWS region:aws ec2 describe-instances --region {{region-name}} --query 'Reservations[*].Instances[*].InstanceId'Run the
associate-iam-instance-profilecommand to attach an instance profile (which contains an IAM role) to the EC2 instance:aws ec2 associate-iam-instance-profile \
--region {{region-name}} \... see more