Restore

Restore RDS Database

The RDS instance has already been restored to the N. California (us-west-1) region due to time constraints. Please review RDS Restore for AWS Backup RDS restore steps.

Launch EC2

1.1 Click AWS Backup to navigate to the dashboard in the N. California (us-west-1) region.

1.2 Click the Backup Vaults link, then click the Default link.

1.3 In the Backups section. Select the EC2 backup. Click Restore under the Actions dropdown.

If you don’t see your backup, check the status of the Copy Job. Click AWS Backup to navigate to the dashboard in N. Virginia (us-east-1) region. Click the Jobs link, then click the Copy jobs link. Verify the Status of your EC2 copy job is Completed.

1.4 In the Network settings section, select backupadnrestore-secondary-EC2SecurityGroup-xxxx as the Security groups and de-select default.

1.5 In the Restore Role section, select Choose an IAM Role and select Team Role as the Role name.

1.6 We are going to want to bootstrap the instance to have the configurations necessary for the Unishop application in the N. California (us-west-1) region. We use user data to achieve this.

Expand the Advanced settings section and copy and paste the below script as the User data, then click the Restore backup button.

User Data Script:

#!/bin/bash     
sudo su ec2-user                        
export AWS_DEFAULT_REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | python -c "import json,sys; print json.loads(sys.stdin.read())['region']")
export DATABASE=$(aws rds describe-db-instances --region $AWS_DEFAULT_REGION --db-instance-identifier backupandrestore-secondary --query 'DBInstances[*].[Endpoint.Address]' --output text)
sudo bash -c "cat >/home/ec2-user/unishopcfg.sh" <<EOF
#!/bin/bash
export DB_ENDPOINT=$DATABASE
EOF
sudo systemctl restart unishop

You will need to wait for the restore job to have a status of Completed before moving on to the next step. This can take several minutes.