Skip to content

Lesson 07 — AWS Systems Manager & Session Manager

Learning Path

☁️ Phase 2 – AWS Cloud Security

📘 Module 05 – Amazon EC2 Security


By the end of this lesson, you will be able to:

  • Understand AWS Systems Manager (SSM).
  • Understand Session Manager.
  • Securely manage EC2 instances without SSH.
  • Configure Session Manager.
  • Register EC2 instances with Systems Manager.
  • Execute remote commands securely.
  • Apply enterprise administration best practices.

📚 Lesson Information

Estimated Time: 2.5 Hours

Difficulty: Intermediate

Prerequisites: Lesson 06 – Amazon EBS Encryption & AMIs

Hands-on Lab: Yes


CloudNova Technologies operates over 500 Amazon EC2 instances across multiple AWS Regions.

Previously, administrators connected using:

  • SSH
  • RDP
  • Bastion Hosts

The security review identified several risks:

  • SSH open to the Internet
  • Key Pair management challenges
  • Shared administrator accounts
  • Difficult audit trails
  • Increased attack surface

The Security Team decided to replace SSH with AWS Systems Manager Session Manager.


Many organisations still manage Linux servers like this:

Administrator
SSH Client
Internet
Public IP
EC2 Instance

Problems:

  • Public IP required
  • Port 22 exposed
  • SSH keys must be protected
  • Difficult auditing
  • Increased attack surface

CloudNova uses AWS Systems Manager.

Administrator
AWS Console
Session Manager
AWS Systems Manager
Private EC2 Instance

No:

  • Public IP
  • SSH Port
  • Bastion Host
  • VPN

is required.


AWS Systems Manager is a management service that allows administrators to securely manage AWS resources.

Capabilities include:

  • Session Manager
  • Run Command
  • Patch Manager
  • Inventory
  • Automation
  • Parameter Store
  • Fleet Manager
  • State Manager

It provides a central platform for managing EC2 instances.


Session Manager is a Systems Manager feature that enables secure shell access through the AWS Management Console or AWS CLI.

Instead of connecting directly to the server using SSH, the connection is established through AWS Systems Manager.

Benefits:

  • No inbound SSH port
  • No SSH keys
  • Full audit logging
  • IAM-controlled access
  • Private connectivity

Cloud Engineer
AWS Console
Session Manager
AWS Systems Manager
IAM Role (SSM)
Private EC2 Instance
──────────────────────────────────────
Supporting Services
CloudWatch
CloudTrail
Amazon S3
VPC Endpoint (Optional)

Component Purpose
Session Manager Secure shell access
Run Command Execute remote commands
Patch Manager Operating system patching
Inventory Collect software inventory
Automation Operational workflows
Parameter Store Secure configuration storage
Fleet Manager Manage server fleet
State Manager Maintain desired configuration

For Systems Manager to communicate with an EC2 instance, the following are required:

  • Systems Manager Agent (SSM Agent)
  • IAM Role
  • Network connectivity to AWS Systems Manager
  • EC2 instance in a supported operating system

The communication is initiated from the EC2 instance to AWS.

No inbound connections are required.


Every EC2 instance should have:

✅ Amazon Linux 2023

✅ IAM Role

AmazonSSMManagedInstanceCore

✅ SSM Agent installed

✅ Internet access or Systems Manager VPC Endpoints


Connect to your EC2 instance.

Run:

Terminal window
sudo systemctl status amazon-ssm-agent

Expected output:

active (running)

Your EC2 instance should have:

CloudNova-EC2-Role

with:

AmazonSSMManagedInstanceCore

attached.


Open:

AWS Console
Systems Manager
Managed Nodes

You should see:

CloudNova-App-Server-01
Status
Online

Navigate to:

Systems Manager
Session Manager
Start Session

Select:

CloudNova-App-Server-01

Click:

Start Session

A browser-based shell opens.

No SSH client is required.


Run:

Terminal window
hostname

Expected:

CloudNova-App-Server-01

Run:

Terminal window
whoami

Expected:

ssm-user

or

ec2-user

depending on your configuration.


Run:

Terminal window
pwd

Terminal window
uname -a

Terminal window
df -h

Terminal window
free -h

Terminal window
uptime

Verify that the instance responds correctly.


Navigate to:

Systems Manager
Run Command
Run Command

Choose:

AWS-RunShellScript

Commands:

Terminal window
hostname
date
uptime

Select:

CloudNova-App-Server-01

Run the command.

Review the output.


Navigate to:

Systems Manager
Inventory

Review collected information:

  • Installed applications
  • Operating system
  • Network interfaces
  • Services

Inventory helps administrators understand what software is installed across the environment.


Navigate to:

Systems Manager
Parameter Store
Create Parameter

Create:

Setting Value
Name /cloudnova/application/environment
Type String
Value Production

Applications can retrieve configuration values securely from Parameter Store instead of hardcoding them.


Terminal window
aws ssm describe-instance-information

Terminal window
aws ssm start-session \
--target i-xxxxxxxx

Terminal window
aws ssm send-command \
--document-name AWS-RunShellScript \
--instance-ids i-xxxxxxxx \
--parameters commands="hostname"

Terminal window
aws ssm describe-parameters

Terminal window
aws ssm get-parameter \
--name "/cloudnova/application/environment"

Verify:

✔ EC2 instance appears as a Managed Node.

✔ SSM Agent is running.

✔ IAM Role attached.

✔ Session Manager connects successfully.

✔ Run Command executes correctly.

✔ Parameter created successfully.


Instance does not appear in Systems Manager.

Check:

  • IAM Role attached.
  • SSM Agent installed.
  • Network connectivity.
  • Region selection.

Session cannot be started.

Verify:

  • EC2 instance is running.
  • Managed Node status is Online.
  • IAM permissions.
  • SSM Agent service.

Run Command fails.

Review:

  • IAM permissions.
  • SSM Agent logs.
  • Command syntax.

Parameter cannot be retrieved.

Check:

  • Parameter name.
  • IAM permissions.
  • AWS Region.

CloudNova standards:

  • Disable direct SSH access where operationally appropriate.
  • Use Session Manager for administration.
  • Remove unnecessary Public IP addresses.
  • Enable CloudTrail logging for Systems Manager activities.
  • Use Parameter Store for configuration values.
  • Use Secrets Manager for sensitive credentials and secrets.
  • Restrict Systems Manager access using IAM.
  • Review Systems Manager logs regularly.

❌ Leaving SSH open to the Internet.

❌ Using shared administrator accounts.

❌ Forgetting to attach the SSM IAM Role.

❌ Ignoring CloudTrail logs.

❌ Hardcoding application configuration.

❌ Using Parameter Store for passwords instead of Secrets Manager.


Configure a second EC2 instance.

Requirements:

  • Amazon Linux 2023
  • CloudNova-EC2-Role
  • SSM Agent running
  • Private Subnet
  • No Public IP

Tasks:

  1. Register the instance with Systems Manager.
  2. Connect using Session Manager.
  3. Execute:
Terminal window
hostname
df -h
uptime
  1. Create a new Parameter:
/cloudnova/application/version

Value:

v1.0
  1. Retrieve the parameter using the AWS CLI.

Capture screenshots of:

  • Managed Nodes
  • Session Manager
  • Run Command
  • Parameter Store
  • AWS CLI outputs

  1. What is AWS Systems Manager?
  2. What problem does Session Manager solve?
  3. Why is Session Manager more secure than SSH?
  4. What IAM policy is required for EC2 Systems Manager access?
  5. What is the purpose of the SSM Agent?
  6. What is Run Command used for?
  7. What information does Inventory collect?
  8. When should you use Parameter Store instead of Secrets Manager?
  9. Which AWS CLI command starts a Session Manager session?
  10. How does Systems Manager reduce the attack surface of EC2 instances?

After completing this lesson, you should understand:

  • AWS Systems Manager provides a central platform for managing EC2 instances securely and at scale.
  • Session Manager enables browser-based or CLI-based access without exposing SSH or RDP ports.
  • EC2 instances require the SSM Agent, an IAM Role and network connectivity to register as managed nodes.
  • Features such as Run Command, Inventory and Parameter Store simplify administration and improve operational consistency.
  • Replacing traditional SSH access with Systems Manager reduces the attack surface, strengthens auditing and aligns with enterprise security best practices.

➡️ Lesson 08 — EC2 Hardening & Patch Management