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 a year ago
- Accepted Answerasked 2 years ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
Thanks so much, will give this a go