Modify Application


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

1.2 Click the Instances (running) link.

1.3 Select the instance that has backupandrestore-us-west-ec2-SG as the Security group name. Click the Connect button.

1.4 Click the Session Manager link, then click the Connect button.

1.5 After a brief moment, a terminal prompt will display.

1.6 Let’s connect to the database in the secondary N. California (us-west-1) region. Replace the below with the endpoint you copied from RDS Section .

sudo su ec2-user
cd /home/ec2-user
sudo mysql -u UniShopAppV1User -P 3306 -pUniShopAppV1Password -h 

1.7 Open the file for editing with either nano or vi.

sudo nano

Tip: You can use the vi (Debian ManPage ) or nano command (Debian ManPage ) to edit the document.

1.8 Replace the with the endpoint you copied from RDS Section . Change the *AWS_DEFAULT_REGION to us-west-1. Add the -dr to the end of the UI_RANDOM_NAME.

export AWS_DEFAULT_REGION=us-west-1
export UI_RANDOM_NAME=backupandrestore-uibucket-xxxx-dr

1.9 Let’s copy the application files to the S3 buckets. Replace the backupandrestore-uibucket-xxxx-dr with the name of your S3 bucket.

If our S3 buckets contained application data then it would be necessary to schedule recurring backups to meet the target RPO. This could be done with Cross Region Replication. Since our buckets contains no data, only code, we will restore the contents from the EC2 instance.

sudo aws s3 cp /home/ec2-user/UniShopUI s3://backupandrestore-uibucket-xxxx-dr/ --recursive --grants read=uri=

1.10 Reboot the EC2 instance so our changes take effect.

sudo reboot

Create application configuration file

2.1 Using your favorite editor, create a new file named config.json file. Set the host property equal to the EC2 public IPv4 DNS name copied from EC2 Section . Add (‘http://') and remove any trailing slash (/) if one is present. Finally, set the region property to us-west-1.

    "host": "{{Replace with your EC2 public IPv4 DNS name copied from EC2 section}}",
    "region": "us-west-1"

Your final config.json should look similar to this example.

    "host": "",
    "region": "us-west-1"


3.1 Click S3 to navigate to the dashbarod.

3.2 Find the bucket that ends with -dr- and click the bucket name link.

3.3 Cick the Upload button.

3.4 Click the Add Files button and specify the config.json file..

3.5 In the Permissions Section section. Select the Specify Individual ACL permissions radio button. Enable the Read checkbox next to Everyone (public access) grantee.

3.6 Enable the I understand the effets of these changes on the specified objects. checkbox. Click the Upload button.

3.7 Click the Properties link. In the Static website hosting section, click the Edit button.

3.8 In the Static website hosting section select the Enable radio button. Enter index.html as the Index document and enter error.html as the Error document.

3.9 Click the Save changes button.

3.10 In the Static website hosting section. Click on the Bucket website endpoint link.

Congratulations ! You should see your application The Unicorn Shop in the us-west-1 region.