Lambda function to automaticaly stop and start the EC2 instance.
Set environment variable AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, and AWS_REGION
.
$ direnv edit . # direnv is not required
export AWS_ACCESS_KEY_ID=AKIAXXXXXXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXX
export AWS_REGION=ap-northeast-1
Clone this repo.
$ git clone https://github.com/enokawa/dawn.git
Install dependencies.
$ cd dawn
$ yarn
Deploy.
$ yarn run deploy
like...
Key | Value |
---|---|
dawn | enable |
Edit cron(0 9 ? * * *)
in serverless.yml
.
Caution!! scheduled events use UTC time zone. See Schedule Expressions for Rules - Amazon CloudWatch Events.
$ yurn run start
$ yurn run stop
$ yarn run remove