Reconfigure Application

We are going to want to change the application that is running in the secondary region to point to the newly promoted Amazon Aurora cluster.

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

1.2 Select hot-secondary, then click the Connect button.

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

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

1.5. Copy and paste the following script which will configure the application to use the secondary region N. California (us-west-1) database and restart the application.

sudo su ec2-user                        
export AWS_DEFAULT_REGION=$(curl -s | python -c "import json,sys; print json.loads(['region']")
export DATABASE=$(aws rds describe-db-clusters --region $AWS_DEFAULT_REGION --db-cluster-identifier hot-secondary --query 'DBClusters[*].[Endpoint]' --output text)
sudo bash -c "cat >/home/ec2-user/" <<EOF
sudo bash -c "cat >/home/ec2-user/" <<EOF
source /home/ec2-user/   
java -jar /home/ec2-user/UniShopAppV1-0.0.1-SNAPSHOT.jar &> /home/ec2-user/app.log &
sudo systemctl restart unishop