Last active
February 8, 2023 19:53
-
-
Save vronin/9303e264854d556a548d90496b605a0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_scheduler_schedule" "my_scheduler" { | |
name = "my-scheduler" | |
group_name = "default" | |
flexible_time_window { | |
mode = "OFF" | |
} | |
# Run it each Monday | |
schedule_expression = "cron(0 9 ? * MON *)" | |
target { | |
# This indicates that the event should be send to EC2 API and startInstances action should be triggered | |
arn = "arn:aws:scheduler:::aws-sdk:ec2:startInstances" | |
role_arn = aws_iam_role.my_role.arn | |
# And this block will be passed to startInstances API | |
input = jsonencode({ | |
InstanceIds = [ | |
aws_instance.my_ec2.id | |
] | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment