-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created TF module to perform AMI backups using Lamda Functions #2
Conversation
b48e31b
to
bec3b82
Compare
main.tf
Outdated
|
||
statement { | ||
actions = [ | ||
"ec2:*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use more precise ACLs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
"ec2:DescribeInstances",
"ec2:CreateImage",
"ec2:CreateTags"
main.tf
Outdated
resource "aws_lambda_function" "ami_backup" { | ||
filename = "${path.module}/lambda_ami_backups.zip" | ||
function_name = "${module.label_backup.id}" | ||
description = "Automatically backs up instances tagged with backup: true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with Automatically backup instances tagged with 'backup: true'
main.tf
Outdated
resource "aws_lambda_function" "ami_cleanup" { | ||
filename = "${path.module}/lambda_ami_cleanups.zip" | ||
function_name = "${module.label_cleanup.id}" | ||
description = "Cleans up old AMI backups" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanup old AMI backups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with Cleanup old AMI backups
main.tf
Outdated
|
||
resource "aws_cloudwatch_event_rule" "ami_backup" { | ||
name = "${module.label_backup.id}" | ||
description = "Schedule for ami snapshot backups" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AMI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with Schedule for AMI snapshot backups
main.tf
Outdated
|
||
resource "aws_cloudwatch_event_rule" "ami_cleanup" { | ||
name = "${module.label_cleanup.id}" | ||
description = "Schedule for ami snapshot cleanup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AMI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with Schedule for AMI snapshot cleanup
main.tf
Outdated
|
||
resource "aws_cloudwatch_event_target" "ami_backup" { | ||
rule = "${aws_cloudwatch_event_rule.ami_backup.name}" | ||
target_id = "schedule_ami_backups" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be namespaced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with target_id = "${module.label_backup.id}"
main.tf
Outdated
|
||
resource "aws_cloudwatch_event_target" "ami_cleanup" { | ||
rule = "${aws_cloudwatch_event_rule.ami_cleanup.name}" | ||
target_id = "schedule_ami_cleanups" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be namespaced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with target_id = "${module.label_cleanup.id}"
Applied all required fixes. |
main.tf
Outdated
resource "aws_lambda_function" "ami_backup" { | ||
filename = "${path.module}/ami_backup.zip" | ||
function_name = "${module.label_backup.id}" | ||
description = "Automatically backup instances tagged with 'backup: true'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snapshot: true
What
Why
References