How To Take A Backup In AWS Using API

How To Take A Backup In AWS Using API

How To Take A Backup In AWS Using API

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

If you are working with AWS, you might get a requirement to take a backup for your data in AWS. You can use AWS backup service to take backup of supported services using UI or API. AWS Backup service currently supports Aurora, RDS, DynamoDB, EC2, EBS, EFS, FSx and Storage gateway backup. In the last blog post, we have discussed key concepts of AWS Backup Service.

https://cloudaffaire.com/key-concepts-of-aws-backup-service/

In today’s blog post, we will discuss how to take a backup in AWS using API. We will use AWS CLI for Backup service to take a backup of an EC2 instance. You can use the same process to take backups of other supported services.

How To Take A Backup In AWS Using API

Prerequisites:

  • AWS CLI installed and configured with proper access. You can use below link to install and configure AWS CLI.

https://cloudaffaire.com/how-to-install-aws-cli/

https://cloudaffaire.com/how-to-configure-aws-cli/

Step 1: Create an IAM role for AWS backup service.

Step 2: Create a backup of an EC2 instance.

Note: We are using the “Default” backup vault to take the backup. Backup service always comes with a default backup vault.

Note: We are using EC2 as an example for this demo, but you can replace the EC2 instance ARN with any supported resource ARN to take the backup of that resource.

Warning: There is additional cost associated with AWS Backup, please refer the AWS backup pricing document for additional details.

Step 3: Get the backup job status.

Note: It may take some time to complete your backup (depends on the EC2 instance size and load). You can check the output of last command for the “State” column. If “State” is “COMPLETED”, that means your backup job completed successfully.

Step 4: Get details on the backup.

Congratulations, you have successfully created a recovery point (backup) of your EC2 instance which you can restore. To reduce the cost, we are going to delete the backup next.

Step 5: Delete the recovery point.

Hope you have enjoyed this article. To know more about AWS Backup, please refer below official documentation

https://docs.aws.amazon.com/aws-backup/index.html

Leave a Reply

Close Menu