1

I just started exploring aws system manager feature.

I am using python 3.6 and boto3 to test ssm.

I have created the Ubuntu server EC2(t2 micro) and assigned the IAM role with policy "AmazonEC2RoleforSSM", which as per my knowledge should allow running ssm send command on that EC2. But, instead I get below error:

botocore.errorfactory.InvalidInstanceId: An error occurred (InvalidInstanceId) when calling the SendCommand operation:

I even tried to check the output of:

ssm.describe_instance_information()['InstanceInformationList'])

It doesn't have the instance Id I created, which pretty much tells the story why I am getting that error. But, to my knowledge if I assign the IAM role with above mentioned policy it should show up in the list.

Strangely when I try to do above setup with Amazon Linux AMI server and run ssm everything looks good.

any idea why ssm not working in ubuntu server? I am missing something?

Bikas Katwal
  • 1,895
  • 1
  • 21
  • 42
  • Possible duplicate of [InvalidInstanceId: An error occurred (InvalidInstanceId) when calling the SendCommand operation](https://stackoverflow.com/questions/47034797/invalidinstanceid-an-error-occurred-invalidinstanceid-when-calling-the-sendco) – kenorb Feb 07 '18 at 16:52

1 Answers1

3

But, to my knowledge if I assign the IAM role with above mentioned policy it should show up in the list.

No, there's much more to it than that. You need to install the AWS SSM agent on each server you want to manage. The reason it is working for you with Amazon Linux is that the latest version of Amazon Linux has the SSM agent pre-installed.

Mark B
  • 183,023
  • 24
  • 297
  • 295
  • SSM Agent is installed, by default, on Amazon Linux AMIs dated 2017.09 and later. – John Hanley Oct 28 '17 at 19:30
  • @JohnHanley isn't that what I said? The server he's having issue with is running Ubuntu, and he said the one that works is running Amazon Linux. He needs to install the agent on the Ubuntu server. – Mark B Oct 28 '17 at 19:34
  • absolutely. I was just helping the answer with the actual date that Amazon Linux included SSM for people who look at your answer six months or two years from now. I was not trying to be critical as your answers are always excellent. – John Hanley Oct 28 '17 at 19:38
  • @JohnHanley ah OK, thanks. I thought you were trying to correct something I said. – Mark B Oct 28 '17 at 19:39
  • @MarkB thanks, didn't even give thought on any package being installed on servers for ssm to work. Installed ssm agent t works now – Bikas Katwal Oct 29 '17 at 06:31