From 8108e7a5c0e9f5c2c3fce15e48345f43e5fe44a2 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Wed, 27 Sep 2023 23:15:36 -0700 Subject: [PATCH] Enable automatic backups for homedirs on AWS "Automatic backups" are documented by AWS in https://docs.aws.amazon.com/efs/latest/ug/awsbackup.html#automatic-backups, and are done *daily* with a 35 day retention period. We could customize this in the future, but this is a great start. Fixes https://github.com/2i2c-org/infrastructure/issues/623 --- terraform/aws/efs.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/terraform/aws/efs.tf b/terraform/aws/efs.tf index d934a1210..5eb3b94d4 100644 --- a/terraform/aws/efs.tf +++ b/terraform/aws/efs.tf @@ -62,3 +62,13 @@ resource "aws_efs_mount_target" "homedirs" { output "nfs_server_dns" { value = aws_efs_file_system.homedirs.dns_name } + +# Enable automatic backups for user homedirectories +# Documented in https://docs.aws.amazon.com/efs/latest/ug/awsbackup.html#automatic-backups +resource "aws_efs_backup_policy" "homedirs" { + file_system_id = aws_efs_file_system.homedirs.id + + backup_policy { + status = "ENABLED" + } +}