2 Answers
- Newest
- Most votes
- Most comments
2
There is no single API to stop all the running instances. You need to get the list of running instance using the describe_instances API. You can use the instance-state-name filter to get only the running instances. Once you have the result, you can extract the instance IDs, place them in an array and call the stop_instances API as you did before.
1
There is also a Solution for stopping instances on a schedule if that is what you are working on. Instance Scheduler on AWS
Relevant content
- asked 3 years ago

Thanks so much, will give this a go