Backup and Restore of EC2 instance using Elastio
Abhishek Sharma
November 24, 2022
Aim: To Back up an EC2 instance and restore on Ubuntu Multipass instance**
Website: https://docs.elastio.com/
Installation and set-up
1. Install and configure AWS
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip awscliv2.zip
- sudo ./aws/install
- Run aws --version
- Configure credentials using aws configure
2. Elastio CLI Installation
-
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/elastio/elastio-stack/master/scripts/install-elastio.sh)"
-
elastio --version ----to verify
-
Create a new vault (optional)
elastio vault init <vault-name>
elastio vault init alpha
-
Run: elastio vault list : omega
3. Backup of EC2 instance
On EC2 instance (back up)
-
Run an ec2 backup using the following command:
sudo -E elastio ec2 backup --vault <vault name> --instance-[<instance-id>]
sudo -E elastio ec2 backup --instance-id i-0681c7639223ec5b8 --vault omega
-
sudo -E elastio ec2 backup --vault <vault name> --instance-[<instance-id>] --background
sudo -E elastio ec2 backup --instance-id i-0681c7639223ec5b8 --vault omega --background
4. Mount Restore of EC2 instance
On Multipass instance (restore)
- Run elastio rp list --ec2 [<instance-id>]
- Copy the rp which is r-dgj61z9zf4ayqmmg5wp0sfcm
- Run lsblk to see the available devices
-
Run mount using the command:
sudo -E elastio mount rp --rp r-dgj61z9zf4ayqmmg5wp0sfcm
-
Success
-
Run ls and you will see the file system on the mount point created
-
The cd and ls to the mount and see the directory file structure.
5. Cleaning up the mounts multipass instance
You can manage your mounted recovery points in the following ways:
5.1 Return the list of mounted RPs
- sudo -E elastio mount list
5.2 Unmount a recovery point by RP ID
- sudo -E elastio umount --id <rp-id>
5.3 Unmount by mount point
- sudo -E elastio umount --mp <mount-point>
5.4 Unmount all
- sudo -E elastio umount --all
6. Clean Up Elastio Deployment
You can clean elastio deployment in the following steps:
6.1. Delete the Elastio vault
Use the following command to delete an Elastio vault:
elastio vault delete --vault <vault-name>
6.2. Destroy the Elastio Stack
The Elastio stack is the CloudFormation stack and should be manually deleted after first removing the Cloud Connector. The Cloud Connector is found in, and can be removed from, the CloudFormation section in the AWS console.
Use the following command to destroy the CloudFormation stack:
elastio stack destroy
6.3. Remove the Elastio Shell
Run the following command to remove the Elastio Shell:
pip3 uninstall elastio_shell
6.4. Remove the Elastio CLI
The next step when cleaning up the Elastio Deployment is to uninstall or remove the Elastio CLI. This is achieved in the following manner.
Use the following script to uninstall the Elastio CLI and Elastio Snap:
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/elastio/elastio-stack/master/scripts/install-elastio.sh) $0" -- -u