How to Set Up AWS SSM Connect on EC2: A Complete Guide (No SSH Required)

Ankur DevAnkur Dev
3 min read

In modern cloud architectures, security and automation are key. AWS Systems Manager (SSM) Session Manager lets you securely connect to your EC2 instances without SSH, open ports, or bastion hosts. It uses SSM Agent and IAM policies to allow browser- or CLI-based shell access to your instances.

In this guide, we’ll walk through everything you needβ€”from IAM setup to connectivity checksβ€”to get SSM Session Manager working seamlessly.

✨ Why Use AWS SSM Connect?

  • No SSH keys to manage

  • No port 22 exposure

  • Centralized auditing and logging

  • Works over private networks via VPC endpoints

  • Supports EC2, on-premises servers, and hybrid environments

🧰 Prerequisites

Before you begin, ensure the following:

ComponentRequirement
EC2 OSAmazon Linux 2, Ubuntu, or other supported OS
AgentSSM Agent installed and running
IAMEC2 instance profile with SSM permissions
ConnectivityInternet access OR SSM VPC endpoints (for private subnets)

πŸ› οΈ Step-by-Step: Setting up AWS SSM Connect

βœ… Step 1: Create an IAM Role for SSM

  1. Go to AWS Console β†’ IAM > Roles > Create role

  2. Trusted entity: Select EC2

  3. Attach permissions policy: Choose AmazonSSMManagedInstanceCore

  4. Give it a name, e.g., EC2SSMRole

  5. Click Create Role

Now, attach this IAM role to your EC2 instance:

  • EC2 Dashboard β†’ Select your instance β†’ Actions > Security > Modify IAM Role

  • Choose EC2SSMRole β†’ Apply

βœ… Step 2: Install and Start the SSM Agent

Amazon Linux 2 and Ubuntu (20.04+):

Pre-installed and auto-running.

Other OS? Install it manually:

Ubuntu example:

sudo snap install amazon-ssm-agent --classic
sudo systemctl enable amazon-ssm-agent
sudo systemctl start amazon-ssm-agent

Check status:

sudo systemctl status amazon-ssm-agent

βœ… Step 3: Ensure Network Connectivity

SSM Agent communicates with the following AWS services:

ServiceRequired for
ssmSSM core APIs
ec2messagesCommunication between EC2 and SSM
ssmmessagesStart-session communication

βœ… Step 4: Verify Instance in Systems Manager

Go to:

AWS Console β†’ Systems Manager β†’ Fleet Manager β†’ Managed Instances

βœ… Your instance should appear online and managed

If not:

  • Verify IAM role is attached

  • Check SSM Agent logs: /var/log/amazon/ssm/amazon-ssm-agent.log

  • Ensure proper internet/VPC connectivity

βœ… Step 5: Connect via Session Manager

Via AWS Console

  1. Go to EC2 β†’ Instances β†’ Select your instance

  2. Click Connect

  3. Select Session Manager tab β†’ Click Connect

πŸ” Optional: Enable Logging and Audit Trails

1. Enable CloudWatch Logs for Session Manager

  • Go to: Systems Manager β†’ Session Manager β†’ Preferences

  • Enable session logging to:

    • CloudWatch Logs group OR

    • S3 bucket

2. Audit with AWS CloudTrail

  • Session events are recorded automatically.

  • You can filter CloudTrail logs by StartSession, SendCommand, etc.

🎯 Final Thoughts

With AWS SSM Session Manager, you no longer need to expose your EC2 instances via SSH. This dramatically improves your security posture and simplifies access management, especially in production or compliance-heavy environments.

Linkedin

1
Subscribe to my newsletter

Read articles from Ankur Dev directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ankur Dev
Ankur Dev

AWS Cloud Expertise : Skilled in EC2, S3, Lambda, CloudFormation, and more to architect, deploy, and manage cloud solutions. Infrastructure as Code (IaC) : Automating cloud infrastructure using Terraform and CloudFormation for consistency and scalability. CI/CD Pipelines : Designing and managing efficient, automated continuous integration and deployment pipelines for faster releases. Containerization & Orchestration : Leveraging Docker and Kubernetes for containerized applications and seamless orchestration. Serverless Architectures : Implementing serverless solutions using AWS Lambda to reduce overhead and enhance scalability. Cloud Security : Ensuring robust security practices and compliance in cloud environments to protect sensitive data. Scripting & Automation : Writing efficient scripts in Python and Bash to automate manual tasks and improve workflow. Monitoring & Logging : Utilizing AWS CloudWatch, ELK Stack, and other tools to monitor and analyze system performance in real-time. Performance Optimization : Focused on optimizing cloud resources to improve speed, scalability, and cost-efficiency.