Profile Applicability:

 Level 2

Description

AWS Systems Manager provides a unified interface to manage your EC2 instances efficiently and securely. It enables capabilities such as patch management, session management, automation, and inventory collection. Ensuring that EC2 instances are managed by Systems Manager helps enforce centralized management, compliance, and operational best practices.

Rationale

  • Centralized Management: Simplifies managing multiple EC2 instances from a single interface.

  • Compliance and Monitoring: Facilitates compliance by automating security patching and monitoring.

  • Security: Enables secure administration of instances without the need to open SSH or RDP access.

  • Automation: Streamlines routine tasks using automation runbooks.

Impact

Pros:

  • Enhances visibility and control over EC2 instances.

  • Improves security by reducing dependency on insecure remote access methods.

  • Simplifies compliance with security and operational standards.

HCons:

  • Requires AWS Systems Manager agent installation on EC2 instances.

  • Instances must meet certain prerequisites such as IAM roles and permissions.

Default Value

By default, EC2 instances are not managed by AWS Systems Manager. Additional configuration is required.

Pre-Requisite

IAM Permissions:

  • ssm:DescribeInstanceInformation

  • ssm:GetInventorySchema

  • ec2:DescribeInstances

  • AWS CLI installed and configured.

Remediation

Test Plan: 

Using AWS Console:

  1. Sign in to the AWS Management Console.

  2. Navigate to the Systems Manager Dashboard.

  1. Select Managed Instances from the left-hand menu.

  2. Verify if all required EC2 instances appear under Managed Instances.

Using AWS CLI:

Check Systems Manager Management Status:

aws ssm describe-instance-information --query "InstanceInformationList[].{InstanceId:InstanceId,ManagedBy:PingStatus}"

Identify Unmanaged Instances:

aws ec2 describe-instances --query "Reservations[].Instances[].{InstanceId:InstanceId}" --output text | grep -vF -f <managed-instances-list.txt>

Implementation Steps: 

Using AWS Console:

  1. Verify prerequisites:

    • Ensure the AWS Systems Manager Agent (SSM Agent) is installed and running on all required instances.

    • Attach an IAM role with the AmazonSSMManagedInstanceCore policy to all EC2 instances.

  2. Navigate to the EC2 Dashboard.

  3. Select instances to register with Systems Manager.

  4. Use the Session Manager for secure management after registration.

Using AWS CLI:

Install and Start the SSM Agent on the instance:

sudo yum install -y amazon-ssm-agent
sudo systemctl start amazon-ssm-agent

Attach IAM Role to the instance:

aws ec2 associate-iam-instance-profile --instance-id <instance-id> --iam-instance-profile Name=<iam-role-name>

Verify that the instance is successfully managed by Systems Manager:

aws ssm describe-instance-information --instance-ids <instance-id>

Backout Plan

Using AWS Management Console:

  1. Sign in to the AWS Management Console.

  2. Navigate to Systems Manager > Managed Instances.

  3. Identify the EC2 instances that were registered with Systems Manager.

  4. Remove the Systems Manager Agent (SSM Agent) from the EC2 instances:

    • Connect to the instance via SSH or Session Manager.

    • Uninstall the SSM Agent using the appropriate command for your operating system.

  5. Update the IAM role attached to the EC2 instances:

    • Remove the permissions required for Systems Manager (e.g., AmazonSSMManagedInstanceCore policy).

  6. Verify that the instances are no longer listed as managed in Systems Manager.

Using AWS CLI:

List the managed instances:

aws ssm describe-instance-information
  1. Remove the SSM Agent from the EC2 instances:

For Linux:

sudo yum remove amazon-ssm-agent

For Windows:
powershell

Uninstall-WindowsFeature -Name AmazonSSMAgent

Update the IAM role attached to the EC2 instances:

aws iam detach-role-policy --role-name <role-name> --policy-arn arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
  1. Verify that the instances are no longer managed:

    aws ssm describe-instance-information

References

CIS Controls

Version

Control ID

Control Description

IG1

IG2

IG3

v8

4.1

Establish and Maintain a Secure Network Architecture – Use centralized management tools like Systems Manager.

v8

5.3

Securely Manage Network Infrastructure – Manage instances to ensure resilience and fault tolerance.