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

Lambda function to automaticaly stop and start the EC2 instance.

Notifications You must be signed in to change notification settings

enokawa/dawn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Lambda function to automaticaly stop and start the EC2 instance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages