I am writing a Python script to determine which EC2 instances have CloudWatch agents installed and which do not. I got some information from CloudWatch Agent Troubleshooting but don't know how to implement it programmatically. Do I use SSM, EC2, or something else?
Asked
Active
Viewed 236 times
0
-
1[boto3 issue CloudWatch Agent #1448](https://github.com/boto/boto3/issues/1448#issuecomment-449501485), shows few recommended API calls to check the same. – samtoddler Feb 24 '21 at 19:54
-
Thank you. I will check that out. – PyNerd Feb 24 '21 at 20:11
2 Answers
1
I'm not aware of external visibility into the status of a particular EC2 instance's CloudWatch Agent.
If your EC2 instances have the SSM Agent preinstalled then you could use boto3 to invoke SSM Run Command to run a collector scripts on each instance (example).
jarmod
- 59,580
- 13
- 95
- 104
-
Thank you. That is what I want to do, but am not sure of which SSM function to use. – PyNerd Feb 24 '21 at 19:56
-
1I linked the boto3 function. It's called `send_command`. This eventually invokes the Run Command feature of SSM afaik. – jarmod Feb 24 '21 at 23:04
-
0
I think the boto3 function send_command is what I am looking for. Thanks, everybody.
PyNerd
- 555
- 1
- 6
- 15