问题
I'm using ec2 for development, and it's a waste of money after work. How much time does it take to create a scheduler that automatically starts every morning at 8 am and ends at 7 pm? I've read the guide provided by AWS, but it's a little difficult. https://aws.amazon.com/ko/answers/infrastructure-management/ec2-scheduler/
回答1:
You can easily make your own scheduler using Amazon CloudWatch Events to trigger an AWS Lambda function on a regular schedule.
- Amazon CloudWatch Events has the ability to schedule events, such as triggering a Lambda function
- A Lambda function can do whatever you wish, such as starting/stopping instances based on a tag
See: Creating an Enterprise Scheduler Using AWS Lambda and Tagging
回答2:
It is also good to make your own guide based, it takes about a week.
Assuming a developer costs around $ 200 per day for a developer, it will take at least $ 1000 for five days of development. The CloudScheduler service is $ 10 per month, and if you have $ 1000, you can use the service for 100 months, about 4 years.
https://scheduler.gncloud.io/
Service is cheaper than development. Just use the service.
回答3:
Though its difficult to implement to scratch, you can use ec2-scheduler.template to deploy the CloudFormation stack to provision the required platform to schedule.
This approach is more convenient than implementing it from scratch using a scheduled Lambda function and EC2 SDK.
回答4:
Zero. AWS just release something that does this for free: https://aws.amazon.com/answers/infrastructure-management/instance-scheduler/
This is a Lambda function that runs regularly and looks for tagged resources to power down. The weaknesses are it is pretty low level and you have to make one fixed schedule for your entire team. But is is free.
Disclosure: I work with PowerDown that offers a product that goes quite a bit further and will also handle AutoScale groups and Fargate containers -- and it will create the schedule for you based on user needs. Here is my write up about it: https://www.powerdown.io/blog/posts/2018/announcing-powerdown.html
来源:https://stackoverflow.com/questions/47233856/aws-ec2-instance-scheduler-easily