Skip to content

Quick Tip – How to fix Session Manager – AWS SSM Agent

how to fix session manager

Hello, today a quick tutorial about AWS Session Manager and Amazon SSM Agent. If you are having problems connecting to EC2(Windows system), by Session Manager then you should read this article to the end. You will learn from it how I deal with such problems.

session manager connection problem 2022
Session Manager connection problems

Before you start

Before you start, make sure you have a role connected to EC2 with the correct permissions. What those permissions should be, you’ll learn from this article: https://lepczynski.it/en/aws_en/session-manager-in-amazon-web-services-aws/

Fixing a problem with Session Manager

It often turned out that the Session Manager was having problems because the SSM Agent was not running.

How to fix it? What can be done to make it work?

Well, I connected via VPN to AWS and then to my machine via RDP. You should use a VPN, but if for some reason you don’t, just log into EC2 using RDP.

1) Situation when you are lucky

Amazon SSM agent start
services – Amazon SSM Agent

On EC2, open the services. If you just click start on Amazon SSM Agent and it works, you’re in luck. Just make sure the agent still has the auto-start option enabled, otherwise the problem will persist.

2) A situation where you are not so lucky

Amazon SSM agent error
Amazon SSM Agent error

If you are not so lucky and the agent is not starting up, but is throwing errors, maybe the problem is in the routing table. Turn on PowerShell and paste these 2 commands:

powershell fix ssm agent
SSM Agent fix PowerStyhell commands
Import-Module "C:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psd1"
Add-Routes

This should fix the routing table. Now when you run the SSM agent it should work, at least it helps me.

3) Situation when you are unlucky

If by some miracle you still have the problem, you’ll have to look in the logs, unfortunately. You’ll usually find them in the directory ProgramData\Amazon\SSM\Logs

ssm agent logs 20222
AWS SSM Agent logs directory

Of course, you can also try removing the agent and reinstalling it.

Summary

It was an AWS Quick Advice article. If I helped and you like such short, quick tips, let me know in the comments.

I will then share a solution to more bugs that I encounter every now and then.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *