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
resource "aws_efs_backup_policy" "nginx-backup-policy" {
file_system_id = aws_efs_file_system.nginx_filesystem.id
backup_policy {
status = "ENABLED"
}
resource "aws_efs_backup_policy" "policy" {
file_system_id = aws_efs_file_system.efs.id
backup_policy {
status = "ENABLED"
}
resource "aws_efs_backup_policy" "policy" {
file_system_id = aws_efs_file_system.efs.id
backup_policy {
status = "ENABLED"
}
}
resource "aws_efs_backup_policy" "minecraft-data-backup-policy" {
file_system_id = aws_efs_file_system.minecraft-data.id
backup_policy {
status = "ENABLED"
}
resource "aws_efs_backup_policy" "gitea-backup-policy" {
file_system_id = aws_efs_file_system.gitea_filesystem.id
backup_policy {
status = "ENABLED"
}
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.
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.
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.