
Let's say you are getting No registered managed instances when selecting your EC2 instances in AWS Systems Manager. For example, I got this when attempting to create a Run Command. Check out my article FreeKB - Amazon Web Services (AWS) - Getting Started with Systems Manger Run Command.
I resolved this by creating a role named my-ec2-ssm-role that contained a Trust Policy that allowed EC2 (ec2.amazonaws.com) to assume the role.
And I attached the AmazonEC2RoleforSSM Permission Policy to the Role.
I then selected my EC2 instance and selected Modify IAM role.
Or the aws ec2 associate-iam-instance-profile command can be used.
aws ec2 associate-iam-instance-profile --instance-id i-abcdefg123456789 --iam-instance-profile Name=my-ec2-ssm-role
And then I saw the instance profile role attached to my EC2 instance.
Or the aws ec2 describe-iam-instance-profile-associations command can be used to confirm the role is now associated with your EC2 instance.
~]$ aws ec2 describe-iam-instance-profile-associations
{
"IamInstanceProfileAssociations": [
{
"AssociationId": "iip-assoc-021ce34b8da300ce8",
"InstanceId": "i-abcdefg123456789",
"IamInstanceProfile": {
"Arn": "arn:aws:iam::123456789012:instance-profile/my-ec2-ssm-role",
"Id": "AIPA2MITL76GIVPJEZ7SW"
},
"State": "associated"
}
]
}
I did have to reboot the EC2 instance and then I was able to see the EC2 instance in Systems Manager. Perfect!
Did you find this article helpful?
If so, consider buying me a coffee over at