How to Backup EFS using AWS Backup
Tags: aws, efs, backup, awsbackup
Published: 2021-06-13 12:05:34

**Backup Creation for EFS**

* AWS Backup now supports Single File Restore for EFS.
* You can create backup by creating a backup plan, assigning it to EFS and then deploy it.

*Refer below steps*

![1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0ehr1s5wao6e0qdudmj.png)

**Restoring Backup for EFS**

* EFS file system restoration can be “Full restore” or through “Item-level restore” of the file system.

1. Full restore — it restores the filesystem in its entirety including all root level folders and files.

2. Item-level restore — you can select and restore up to 5 items within your Elastic File System. Enter a relative path to a file or folder.

* EFS Backup can be restored to the new EFS file system or to the source EFS file system using AWS Backup API, CLI, or AWS Console.

**AWS Backup (Console)**

i. Open the AWS Backup console.

ii. In the navigation pane, choose Protected resources. A list of your recovery points, including the resource type, is displayed by Resource Id. Choose a resource to open the Backups pane.

iii. To restore a resource, choose the radio button next to the recovery point in the Backups pane, and then choose Restore in the upper-right corner of the pane.

iv. Specify the restore parameters. Select restoration method by either:

a. Restore to a new file system.

![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wj7rn2csjatfbbva7o4q.png)

b. Restore to directory in source file system.

![3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mkrew0g8xetgp48o7c4.png)

v. For IAM role, choose Default role.

Note: If the AWS Backup default role is not present in your account, one will be created for you with the correct permissions.

vi. Choose Restore resource.

* You are brought to the restore jobs table, and you should see a message at the top of the page informing you about the restore job.
* The message also includes a link to the service console of the resource that you just restored.
* You can switch to that console and take action on the new resource that you created from the backup.

**AWS Backup (CLI)**

*Amazon EFS Restore Metadata*

* Use the following information to restore an Amazon Elastic File System (Amazon EFS) instance:

*file-system-id* — ID of the Amazon EFS file system that is backed up by AWS Backup. Returned in GetRecoveryPointRestoreMetadata.

*Encrypted* — A Boolean value that, if true, specifies that the file system is encrypted. If KmsKeyId is specified, Encrypted must be set to true.

*KmsKeyId* — Specifies the AWS KMS key that is used to encrypt the restored file system.

*PerformanceMode* — Specifies the throughput mode of the file system.

*CreationToken* — A user-supplied value that ensures the uniqueness (idempotency) of the request.

*newFileSystem* — A Boolean value that, if true, specifies that the recovery point is restored to a new Amazon EFS file system.

Example:
```
aws backup start-restore-job --recovery-point-arn arn:aws:backup:ap-southeast-1:123456789:recovery-point:f95aab35-b90a-4e40-8269-b43797c5234df5 --metadata file-system-id=fs-2de30e6c,Encrypted=true,PerformanceMode=generalPurpose,newFileSystem=true,KmsKeyId=aws/elasticfilesystem,CreationToken=efsrestore --iam-role-arn arn:aws:iam::123456789/service-role/AWSBackupDefaultServiceRole --resource-type EFS
```

**Reference**

[https://docs.aws.amazon.com/cli/latest/reference/backup/start-restore-job.html]
[https://docs.aws.amazon.com/aws-backup/latest/devguide/API_StartRestoreJob.html]