Incorrect instance count when using SSM
See original GitHub issuePlease 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:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
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?