본문 바로가기

AWS

CloudFormation을 통한 개발서버 On/Off 스케줄링 (실패)

# CloudFormation 생성

# 템플릿 추가 후 실행
- https://s3.amazonaws.com/solutions-reference/aws-instance-scheduler/latest/instance-scheduler.template

# Service(s) to schedule -> BOTH

# Default time zone -> Asia/Seoul

# Enable CloudWatch Metrics -> Yes

# Started tags -> state=started

# Stopped tags -> state=stopped

# 다음 - 다음

# AWS CloudFormation에서 사용자 정의 이름으로 IAM 리소스를 생성할 수 있음을 승인합니다. 체크 후 생성

# https://docs.aws.amazon.com/ko_kr/solutions/latest/instance-scheduler/appendix-a.html 참고

scheduler-cli create-period --stack 스케줄러명 --region 리전명 --name firstdayofmonth --begintime 09:00 --endtime 19:00 --monthdays 1
scheduler-cli create-schedule --stack 스케줄명 --name dayone --region 리전명 --periods firstdayofmonth --timezone Asia/Seoul

# DynamoDB로 이동

# ConfigTable 선택 후 시간에 대한 부분은 전부 09:00 ~ 19:00, Asia/Seoul로 변경

# 되기를 기다린다.

물론 되진 않았다. 중간까진 잘 간것 같은데 한국시간 (KST)와 기준시간 (UTC)의 시간차가 9시간이 있으니 그 기준으로도 확실히 계산이 필요.

람다 스케줄링으론 큰 문제 없이 성공할 것으로 보이며, python boto core 라이브러리를 이용해서 ec2 on/off scheduling 하는 것이 현명해 보임