Elastic File System Should Have Backup Plan
More Info:
This rule checks if Amazon Elastic File System (Amazon EFS) File Systems are protected by a backup plan. The rule is NON_COMPLIANT if the EFS File System is not covered by a backup plan.
Risk Level
High
Address
Configuration
Compliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
To remediate the misconfiguration of not having a backup plan for Elastic File System (EFS) in AWS EC2 using the AWS Management Console, follow these steps:
-
Sign in to the AWS Management Console: Go to https://aws.amazon.com/ and sign in to your AWS account.
-
Navigate to the Elastic File System (EFS) Service: Click on the "Services" dropdown in the top navigation bar and select "Elastic File System" under the "Storage" category.
-
Select the EFS File System: From the list of EFS file systems, select the EFS file system that you want to create a backup plan for by clicking on its name.
-
Create a Backup Plan:
- Click on the "Backup" tab on the EFS file system details page.
- Click on the "Create Backup Plan" button.
-
Configure Backup Plan:
- Enter a name for the backup plan.
- Choose the backup frequency and retention policy that suits your requirements. For example, you can set up daily backups with a retention period of 30 days.
- Configure any lifecycle policies if needed.
-
Review and Create Backup Plan:
- Review the backup plan configuration to ensure it meets your requirements.
- Click on the "Create" or "Save" button to create the backup plan for the EFS file system.
-
Monitor Backup Plan:
- Once the backup plan is created, you can monitor the backups and their status from the "Backup" tab on the EFS file system details page.
- Ensure that backups are running as per the configured schedule and that you can restore data if needed.
By following these steps, you have successfully remediated the misconfiguration by creating a backup plan for your Elastic File System in AWS EC2 using the AWS Management Console. This will help ensure data protection and availability in case of any unexpected events or data loss situations.
Using CLI
To remediate the misconfiguration of not having a backup plan for Elastic File System (EFS) in AWS EC2 using AWS CLI, you can follow these steps:
-
Create a Backup Plan:
- Use the AWS CLI command
create-backup-planto create a backup plan for your EFS file system. - Specify the backup plan details such as name, schedule, retention policy, and backup vault.
- Example command:
aws backup create-backup-plan --backup-plan "Name=MyBackupPlan,BackupPlanRule={RuleName=DailyBackup,ScheduleExpression=\"cron(0 0 * * ? *)\",TargetBackupVaultName=MyBackupVault,StartWindowMinutes=60,CompletionWindowMinutes=120,Lifecycle={MoveToColdStorageAfterDays=30,DeleteAfterDays=90}}"
- Use the AWS CLI command
-
Assign Backup Plan to EFS File System:
- Use the AWS CLI command
put-backup-vault-access-policyto assign the created backup plan to your EFS file system. - Specify the EFS file system ID and the ARN of the backup plan.
- Example command:
aws backup put-backup-vault-access-policy --backup-vault-name MyBackupVault --policy "{\"BackupPlanId\":\"arn:aws:backup:us-west-2:123456789012:backup-plan:MyBackupPlan\"}"
- Use the AWS CLI command
-
Enable Backup for EFS File System:
- Use the AWS CLI command
start-backup-jobto initiate the backup process for your EFS file system. - Specify the EFS file system ID and the backup vault name.
- Example command:
aws backup start-backup-job --backup-vault-name MyBackupVault --resource-arn arn:aws:elasticfilesystem:us-west-2:123456789012:file-system/fs-12345678
- Use the AWS CLI command
-
Verify Backup Status:
- Use the AWS CLI command
describe-backup-jobto check the status of the backup job for your EFS file system. - Monitor the progress and ensure that the backup is successfully completed.
- Example command:
aws backup describe-backup-job --backup-job-id abcdef12-3456-7890-abcd-1234567890ab
- Use the AWS CLI command
By following these steps, you can remediate the misconfiguration of not having a backup plan for your EFS file system in AWS EC2 using AWS CLI. This will help you ensure data protection and recovery in case of any unexpected data loss or corruption.
Using Python
To remediate the misconfiguration of not having a backup plan for Elastic File System (EFS) in AWS EC2 using Python, you can follow these steps:
-
Install Boto3: Boto3 is the AWS SDK for Python. You can install it using pip:
pip install boto3 -
Create a Backup Plan: You can create a backup plan using AWS Backup service. Here's an example Python script to create a backup plan for your EFS:
import boto3# Initialize the AWS Backup clientbackup_client = boto3.client('backup')# Define the resource ARN for your EFS file systemresource_arn = 'arn:aws:elasticfilesystem:us-east-1:123456789012:file-system/fs-12345678'# Define the backup plan name and backup rulebackup_plan_name = 'EFS-Backup-Plan'backup_rule = {'RuleName': 'EFS-Backup-Rule','TargetBackupVaultName': 'MyBackupVault','ScheduleExpression': 'cron(0 12 * * ? *)', # Daily backup at 12:00 PM UTC'StartWindowMinutes': 60,'CompletionWindowMinutes': 60}# Create a backup planresponse = backup_client.create_backup_plan(BackupPlan = {'BackupPlanName': backup_plan_name,'BackupPlanRule': backup_rule})print('Backup plan created successfully!')Make sure to replace the
resource_arnwith the ARN of your EFS file system and customize the backup plan name, rule, and schedule as needed. -
Run the Python Script: Save the above Python script in a file (e.g.,
create_backup_plan.py) and run it using Python:python create_backup_plan.py -
Verify Backup Plan: You can verify the backup plan by checking the AWS Backup console or by listing the backup plans using the AWS CLI:
aws backup list-backup-plans
By following these steps, you can create a backup plan for your EFS file system in AWS EC2 using Python and ensure that you have a backup strategy in place for your data.
Using Terraform
# Existing (or separately-managed) EFS file system
resource "aws_efs_file_system" "THIS_EFS" {
# ...existing config...
}
# OPTIONAL: data source for an existing backup plan (if you know its ID)
# Replace BACKUP_PLAN_ID with the actual backup plan ID, or remove this
# data block and hardcode the ID directly in aws_backup_selection.
data "aws_backup_plan" "TARGET_PLAN" {
backup_plan_id = "BACKUP_PLAN_ID" # <-- replace with your existing Backup Plan ID
}
# OPTIONAL: data source for the existing AWS Backup service role
# If you do not already have a role, create one with the AWSBackupServiceRolePolicyForBackup policy.
data "aws_iam_role" "backup_role" {
name = "AWSBackupDefaultServiceRole" # or another suitable role name
}
# Attach the EFS file system to the backup plan (equivalent to aws backup create-backup-selection)
resource "aws_backup_selection" "efs_backup_selection" {
name = "efs-THIS_EFS-selection" # arbitrary selection name
iam_role_arn = data.aws_iam_role.backup_role.arn
plan_id = data.aws_backup_plan.TARGET_PLAN.id
resources = [
aws_efs_file_system.THIS_EFS.arn,
]
}
This change does not replace the EFS file system; it only creates a new AWS Backup selection attaching it to an existing backup plan.
To verify, terraform plan should show creation of an aws_backup_selection resource referencing your existing backup plan ID, backup IAM role ARN, and the target EFS file system ARN, with no changes to the EFS resource itself.