- Notifications
You must be signed in to change notification settings - Fork3
Automates snapshots using the new DLM policy support in AWS and Terraform
License
JamesWoolfenden/terraform-aws-dlmautosnapshot
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Terraform module - creates ups data life-cycle management to automate ebs backups.
It's 100% Open Source and licensed under theAPACHE2.
Include this repository as a module in your existing terraform code:
module"dlmautowsnapshot" {source="JamesWoolfenden/dlmautowsnapshot/aws"version="0.2.9"common_tags=var.common_tagssnapshot_name=local.snapshot_namecron_expression=var.cron_expressionregions=var.regions}
The management of EC2 backup has become simpler With the new release of Data Lifecycle Manager (DLM) policieshttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-lifecycle.html.There is no more need for a Lambdas to manage EBS snapshots, and additionally with the new release of support for DLM in Terraformhttps://www.terraform.io/docs/providers/aws/r/dlm_lifecycle_policy.html it can achieved easily.
The example - exampleA shows how to implement a DLM policy on EBS snapshots.As before you include a reference to the module in your code.
In the example the variable schedule is an extensible list of maps.
schedule = [{name = "2 weeks of daily snapshots"create_rule=[{interval = 24interval_unit = "HOURS"times = ["23:45"]}]retain_rule=[{count = 14}]tags_to_add {SnapshotCreator = "DLM"}copy_tags = false}]
That's all for now.
No requirements.
Name | Version |
---|---|
aws | n/a |
No modules.
Name | Type |
---|---|
aws_dlm_lifecycle_policy.lifecycle | resource |
aws_iam_role.dlm_lifecycle | resource |
aws_iam_role_policy.dlm_lifecycle | resource |
aws_iam_policy_document.dlm | data source |
aws_iam_policy_document.trust | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
common_tags | Implements the common tags scheme | map(any) | n/a | yes |
schedule | The DLM Schedule | list(any) | n/a | yes |
schedule_copy_tags | n/a | bool | false | no |
schedule_interval | Interval between | number | 24 | no |
schedule_interval_unit | Schedile Interval Unit | string | "HOURS" | no |
schedule_name | Name of the Schedule | string | "2 weeks of daily snapshots" | no |
schedule_retain | n/a | number | 14 | no |
schedule_times | When the policy should run | string | "23:45" | no |
Name | Description |
---|---|
lifecycle | n/a |
This is the policy required to build this project:
The Terraform resource required is:
resource"aws_iam_policy""terraform_pike" {name_prefix="terraform_pike"path="/"description="Pike Autogenerated policy from IAC"policy=jsonencode({"Version":"2012-10-17","Statement": [ {"Sid":"VisualEditor0","Effect":"Allow","Action": ["dlm:CreateLifecyclePolicy","dlm:DeleteLifecyclePolicy","dlm:GetLifecyclePolicy","dlm:ListTagsForResource","dlm:UpdateLifecyclePolicy" ],"Resource": "*" }, {"Sid":"VisualEditor1","Effect":"Allow","Action": ["ec2:DescribeAccountAttributes" ],"Resource": "*" }, {"Sid":"VisualEditor2","Effect":"Allow","Action": ["iam:CreateRole","iam:DeleteRole","iam:DeleteRolePolicy","iam:GetRole","iam:GetRolePolicy","iam:ListAttachedRolePolicies","iam:ListInstanceProfilesForRole","iam:ListRolePolicies","iam:PutRolePolicy","iam:TagRole" ],"Resource": "*" }, {"Sid":"VisualEditor3","Effect":"Allow","Action": ["kms:DescribeKey","kms:ListAliases" ],"Resource": "*" } ]})}
Check out these related projects.
- terraform-aws-s3 - S3 buckets
Got a question?
File a GitHubissue.
Please use theissue tracker to report any bugs or file feature requests.
Copyright © 2019-2022 James Woolfenden
SeeLICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE filedistributed with this work for additional informationregarding copyright ownership. The ASF licenses this fileto you under the Apache License, Version 2.0 (the"License"); you may not use this file except in compliancewith the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,software distributed under the License is distributed on an"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied. See the License for thespecific language governing permissions and limitationsunder the License.
About
Automates snapshots using the new DLM policy support in AWS and Terraform
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.