AWS Amazon EFS Backup Policy

This page shows how to write Terraform and CloudFormation for Amazon EFS Backup Policy and write them securely.

aws_efs_backup_policy (Terraform)

The Backup Policy in Amazon EFS can be configured in Terraform with the resource name aws_efs_backup_policy. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

nginx.tf#L14
resource "aws_efs_backup_policy" "nginx-backup-policy" {
  file_system_id = aws_efs_file_system.nginx_filesystem.id

  backup_policy {
    status = "ENABLED"
  }
efs.tf#L22
resource "aws_efs_backup_policy" "policy" {
  file_system_id = aws_efs_file_system.efs.id

  backup_policy {
    status = "ENABLED"
  }
efs.tf#L11
resource "aws_efs_backup_policy" "policy" {
  file_system_id = aws_efs_file_system.efs.id
  backup_policy {
    status = "ENABLED"
  }
}
efs.tf#L18
resource "aws_efs_backup_policy" "minecraft-data-backup-policy" {
  file_system_id = aws_efs_file_system.minecraft-data.id

  backup_policy {
    status = "ENABLED"
  }
gitea.tf#L14
resource "aws_efs_backup_policy" "gitea-backup-policy" {
  file_system_id = aws_efs_file_system.gitea_filesystem.id

  backup_policy {
    status = "ENABLED"
  }

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The following arguments are supported:

  • file_system_id - (Required) The ID of the EFS file system.
  • backup_policy - (Required) A backup_policy object (documented below).

Backup Policy Arguments

For backup_policy the following attributes are supported:

  • status - (Required) A status of the backup policy. Valid values: ENABLED, DISABLED.

In addition to all arguments above, the following attributes are exported:

  • id - The ID that identifies the file system (e.g., fs-ccfc0d65).

Explanation in Terraform Registry

Provides an Elastic File System (EFS) Backup Policy resource. Backup policies turn automatic backups on or off for an existing file system.

Tips: Best Practices for The Other AWS Amazon EFS Resources

In addition to the aws_efs_file_system, AWS Amazon EFS has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_efs_file_system

Enable at rest encryption of EFS

It is better to enable at rest encryption of EFS to reduce the risk of data leakage.

Review your AWS Amazon EFS settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::EFS::FileSystem BackupPolicy (CloudFormation)

The FileSystem BackupPolicy in EFS can be configured in CloudFormation with the resource name AWS::EFS::FileSystem BackupPolicy. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Status Set the backup policy status for the file system.

  • ENABLED - Turns automatic backups on for the file system.
  • DISABLED - Turns automatic backups off for the file system.Required: Yes
    Type: String
    Allowed values: DISABLED | DISABLING | ENABLED | ENABLING
    Update requires: No interruption

Explanation in CloudFormation Registry

The backup policy turns automatic backups for the file system on or off.

Frequently asked questions

What is AWS Amazon EFS Backup Policy?

AWS Amazon EFS Backup Policy is a resource for Amazon EFS of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EFS Backup Policy?

For Terraform, the samyak-jain/server_config, ru-rocker/asg-ec2-codedeploy-efs-terraform and vinycoolguy2015/awslambda source code examples are useful. See the Terraform Example section for further details.