Commit d7e6e386 authored by A-Gordon's avatar A-Gordon

Reduced invoke rate to 5 mins and Instance timeout to 50, will help keep instances under 1 hour

parent 8565b064
variable "cloudwatch_schedule" {
description = "Schedule for cloudwatch event to invoke Lambda function"
default = "rate(2 hours)"
default = "rate(5 minutes)"
}
resource "aws_iam_role" "packer_janitor" {
......
......@@ -53,7 +53,7 @@ def lambda_handler (event, context):
logger.info('[%s]: Runtime: %s days', instance.id, runtime_days)
logger.info('[%s]: Runtime: %s mins', instance.id, runtime_minutes)
if (runtime_days >= 1) or (runtime_minutes >= 120):
if (runtime_days >= 1) or (runtime_minutes >= 50):
logger.info('[%s]: Instance has been running for %s days and %s mins. Marking for termination', instance.id, runtime.days, runtime_minutes)
instance.terminate(DryRun=DRYRUN)
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment