Ensure AWS Systems Manager is used for managing EC2 instances
| Rule | EC2 instances should be managed by AWS Systems Manager |
| Framework | AWS Foundational Security Best Practices |
| Severity | ✔ Medium |
Rule Description:
The rule states that EC2 instances should be managed by AWS Systems Manager to ensure compliance with AWS Foundational Security Best Practices. AWS Systems Manager provides a centralized, unified way to automate operational tasks such as patch management, configuration management, and instance inventory in a secure and controlled manner.
By using AWS Systems Manager to manage EC2 instances, organizations can maintain better control over their infrastructure, ensure compliance with security policies, and respond quickly to security incidents or vulnerabilities.
Troubleshooting Steps:
If EC2 instances are not managed by AWS Systems Manager, follow these troubleshooting steps:
Verify Systems Manager Agent (SSM Agent) is installed:
sudo systemctl status amazon-ssm-agentCheck Systems Manager association status:
Verify IAM permissions:
Update Systems Manager preferences:
Connectivity and networking checks:
Necessary Codes:
No code is required for this rule. However, you may need to run certain AWS CLI commands to troubleshoot and manage Systems Manager:
To install the SSM Agent:
sudo yum install -y amazon-ssm-agent (for Amazon Linux 2)
sudo apt-get install -y amazon-ssm-agent (for Ubuntu)To check the status of the SSM Agent:
sudo systemctl status amazon-ssm-agentTo list managed instances:
aws ssm describe-instance-informationTo attach required policies to the IAM role:
aws iam attach-role-policy --role-name [role_name] --policy-arn arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
aws iam attach-role-policy --role-name [role_name] --policy-arn arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSMStep-by-step Guide for Remediation:
To remediate non-compliant EC2 instances and ensure they are managed by AWS Systems Manager, follow these steps:
Install the SSM Agent:
Verify SSM Agent installation:
sudo systemctl status amazon-ssm-agent.Check Systems Manager association status:
Verify IAM permissions:
Update Systems Manager preferences (optional):
Connectivity and networking checks:
Once these steps are completed, your EC2 instances will be managed by AWS Systems Manager, ensuring compliance with AWS Foundational Security Best Practices.