This is an AWS CDK Construct to make EC2 instance running schedule (only running while working hours(start/stop)).
- EC2 Instance
This construct creating resource list.
- EventBridge Scheduler execution role
- EventBridge Scheduler
- Step Functions State machine
- Step Functions State machine role
npm install @gammarer/aws-ec2-instance-running-schedule-stackyarn add @gammarer/aws-ec2-instance-running-schedule-stackpip install gammarer.aws-ec2-instance-running-schedule-stackdotnet add package Gammarer.CDK.AWS.Ec2InstanceRunningScheduleStackimport { Ec2InstanceRunningScheduleStack } from '@gammarer/aws-ec2-instance-running-schedule-stack';
new EC2InstanceRunningScheduleStack(app, 'EC2InstanceRunningScheduleStack', {
targetResource: {
tagKey: 'WorkHoursRunning',
tagValues: ['YES'],
},
startSchedule: {
timezone: 'Asia/Tokyo',
minute: '55',
hour: '8',
week: 'MON-FRI',
},
stopSchedule: {
timezone: 'Asia/Tokyo',
minute: '5',
hour: '19',
week: 'MON-FRI',
},
notifications: { // OPTIONAL NOTIFICATION
emails: [ // OPTIONAL SEND EMAIL FROM SNS
'[email protected]',
'[email protected]',
],
},
});This project is licensed under the Apache-2.0 License.
