Amazon EC2 logoAmazon EC2 logo

The other day I stumbled upon a string of similar events logged from some of my Windows EC2 instances in regards to the SSM Agent. It simply refused to start up, and examining the log files, I could see the following:

2022-09-23 08:09:39 ERROR Agent failed to assume any identity
2022-09-23 08:09:39 ERROR failed to find identity, retrying: failed to find agent identity

After a little digging, the likely culprit was a corrupt EC2Launch installation and missing routes for it to communicate with the AWS backbone. Fixing this was quite easy once I knew what the issue was.

First we need to update EC2Launch

mkdir $env:USERPROFILE\Desktop\EC2Launch
$Url = ""
$DownloadZipFile = "$env:USERPROFILE\Desktop\EC2Launch\" + $(Split-Path -Path $Url -Leaf)
Invoke-WebRequest -Uri $Url -OutFile $DownloadZipFile
$Url = ""
$DownloadZipFile = "$env:USERPROFILE\Desktop\EC2Launch\" + $(Split-Path -Path $Url -Leaf)
Invoke-WebRequest -Uri $Url -OutFile $DownloadZipFile
& $env:USERPROFILE\Desktop\EC2Launch\install.ps1

Then once EC2Launch has been updated, we need to add the default routes required.

Import-Module "C:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psd1"

Now go back to services.msc and perform a stop and start of the SSM Agent. It should now be able to start up again without any issues.

By Jostein Elvaker Haande

"A free society is a society where it is safe to be unpopular" - Adlai Stevenson

One thought on “[HOWTO] EC2Launch – agent failed to assume identity”
  1. THANK YOU!!! I’m on Linux, but your article helped me fix my issue by uninstalling and reinstalling the SSM agent.

    For anyone else who winds up here in a similar situation:

    sudo yum remove amazon-ssm-agent
    sudo yum install amazon-ssm-agent
    sudo reboot

Leave a Reply

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