I'm working with a legacy Adobe ColdFusion stack (there are plans to redevelop using something more contemporary), and we have an issue whereby very occasionally, the CPU will spike and we need to restart ColdFusion and IIS on the Windows EC2 host.
I have some CloudWatch Alarms which trigger lambda functions that I found and adapted to send a Slack notifications. If I'm around, or the developers (I'm very much ops, but trying to understand more dev stuff as time goes on), one of us will jump on the server and restart the service, collect the logs, and the devs can use it to try and narrow down why it happens.
What I would like is another alarm which triggers maybe 15 minutes after the first one, to call the AWS-RunRemoteScript document in SSM, which runs a powershell script stored in S3 which simply stops and starts the services in the right order (restart doesn't work - I've found we need to stop CF, stop IIS, and then bring them back up in that order).
I have used that Run Command with RunRemoteScript, and it works a treat. What I'm really struggling with it how to make a lambda function call SSM and have it run that automation for me. I have searched high and low, but the few resources I have found are too complex for my extremely limited grasp of programming.
Please can someone help me out by showing me or pointing me to a resource which can walk me through creating a Lambda script (preferably in Python, since I am actively trying to learn it) to call SSM and within that, the RunCommand for AWS-RunRemoteScript, how to plug in the parameters (script location etc.) and make it work?