question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect instance count when using SSM

See original GitHub issue

Please fill out the sections below to help us address your issue.

What issue did you see ? I used the following to extract all the SSM-managed instances in the account:

ssm_instances = [i['InstanceId'] for i in boto3.client('ssm').describe_instance_information()['InstanceInformationList']]

In the AWS SSM Fleet Manager, the total number of instances is 43 but the output of the command above is only 10. I’m not sure why this is happening.

Steps to reproduce

import boto3
ssm_instances = [i['InstanceId'] for i in boto3.client('ssm').describe_instance_information()['InstanceInformationList']]
print(ssm_instances)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
prandeliciouscommented, Mar 1, 2021

Thank you for looking into this! I can confirm that this was indeed due to lack of pagination. I have included pagination support since then and can confirm that I’m getting the correct count of instances in SSM. Appreciate your effort in validating this, @stobrien89!

1reaction
stobrien89commented, Feb 24, 2021

Hi again @prandelicious,

I reviewed this with a teammate and realized it did not occur to me that this could be due to lack of pagination. It could be that the MaxResults default for this operation is 10 (it isn’t listed on the API reference page). Have you tried adding a paginator/iterator to the client?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting managed node availability
Solution 1: Verify that SSM Agent is installed and running on the managed node · Working with SSM Agent on EC2 instances for...
Read more >
class SSM. Client - Boto3 Docs 1.26.32 documentation - AWS
State Manager association targets only : Key=InstanceIds,Values=* This example demonstrates how to target all managed instances in the Amazon Web Services ...
Read more >
Troubleshooting Session Manager - Amazon Systems Manager
Solution B: The proxy configuration you applied to the SSM Agent on your managed node might be incorrect. If the proxy configuration is...
Read more >
AWS SSM document, syntax wrong, cant create document
So i'm trying to create a SSM document with the instance ID below, so i can then link it to event bridge to...
Read more >
Experiment (CLI) - Chaos Engineering on AWS
In this section we will show you how to create an experiment using AWS FIS ... only target running EC2 instances we could...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found