Create an EFS backup policy with the create-backup-policy command:
aws backup create-backup-policy --backup-policy-name <backup-policy-name> --file-system-id <file-system-id> --schedule-expression "cron(0 12 ? * * *)"
This command creates a new backup policy with the given name, and associates it with the specified EFS file system ID. The backup will be taken daily at 12 PM UTC.
Wait for the first backup to complete:
aws backup list-backups --resource-arn <efs-resource-arn> --backup-state AVAILABLE
This command lists all available backups for the EFS file system associated with the specified resource ARN.
Restore a file system from backup:
aws backup start-restore-job --recovery-point-arn <recovery-point-arn> --metadata file-system-id=<new-file-system-id>,SubnetIds=<subnet-id>,SecurityGroupIds=<security-group-id>
Use the recovery point ARN obtained from the output of the previous command to restore the file system from backup. Specify the metadata for the new file system, including a new file system ID, subnet IDs, and security group IDs.
Wait for the restore job to complete:
aws backup describe-restore-job --restore-job-id <restore-job-id>
Use the restore job ID obtained from the output of the previous command to monitor the status of the restore job. Wait for the job to complete.