EC2

Launch EC2

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

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

1.2 Select pilotAMI. Click the Launch instance from AMI button.

1.3 Enter pilot-secondary as the Name.

1.4 In the Key pair (login) section. Select ee-default-keypair as the Key pair name.

1.5 In the Network settings section click the Edit button.

1.6 Select pilot-secondary as the VPC. Select Select existing security group for the Firewall (security groups) and then select pilot-secondary-EC2SecurityGroup-xxx as the Common security groups.

1.7 Expand the Advanced details section. Select pilot-secondary-S3InstanceProfile-xxx as the IAM instance profile.

1.8 Copy and paste the following script into User data which will configure the application to use the secondary region N. California (us-west-1) database and restart the application. Then click the Launch instance button. To learn more, see user data.

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-clusters --region $AWS_DEFAULT_REGION --db-cluster-identifier pilot-secondary --query 'DBClusters[*].[Endpoint]' --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 instance to be successfully launched. You can click the View all instances button to navigate to the EC2 dashboard. Verify pilot-secondary has an Instance state of Running. This can take several minutes.