Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Latest commit

 

History

History
executable file
·
63 lines (49 loc) · 1.21 KB

README.md

File metadata and controls

executable file
·
63 lines (49 loc) · 1.21 KB

dawn

Lambda function to automaticaly stop and start the EC2 instance.

Prerequisite

Usage

Set AWS credentials and region

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

Deploy Lambda Functions

Clone this repo.

$ git clone https://github.com/enokawa/dawn.git

Install dependencies.

$ cd dawn
$ yarn

Deploy.

$ yarn run deploy

Set Tag for EC2 Instance

like...

Key Value
dawn enable

Change Schedule

Edit cron(0 9 ? * * *) in serverless.yml.
Caution!! scheduled events use UTC time zone. See Schedule Expressions for Rules - Amazon CloudWatch Events.

Invoke functions manually

$ yurn run start
$ yurn run stop

Remove funtions

$ yarn run remove

Inspired by ...

https://github.com/y13i/amirotate