Disaster!

When a regional service event affects the Unicorn application in the Primary, N. Virginia (us-east-1) region, you want to fail-over to Secondary, N. California (us-west-1) region.

We assume a regional service event has occurred. In this section, we will manually fail over the application to the Secondary region. The CloudFront distribution will detect the service interruption and automatically begin routing requests from the Primary-Active to the Passive-Secondary website seamlessly.

Before simulating the outage, we need to create test data through the web application. This step requires creating enrolling in the store, then adding items into the shopping cart. After the outage, the user’s session should remain active and uninterrupted.

Create and Populate the Shopping Cart

1.1 Navigate to the CloudFront Domain Name using your favorite browser.

If you don’t have your CloudFront Domain Name, you can retrieve it via Step 4.2 in Setup CloudFront.

1.2 Click the Signup button.

1.3 Register yourself into the application. You need to provide an e-mail address, which does not need to be valid.

1.4 Log in to the application using your e-mail address from the previous step.

1.5 Add/remove items to your shopping cart by clicking on a Unicorn, followed by clicking the Add to cart button.

Simulating a Regional Service Event

We will now simulate a regional service event affecting the S3 static website in N. Virginia (us-east-1) serving The Unicorn Shop website.

2.2 Navigate to S3 in the console.

2.3 Click into the active-primary-uibucket-xxxx bucket.

2.4 Under the Permissions tab, click the Edit button to modify the Block public access (bucket settings) configuration.

2.5 Enable the Block all public access checkbox and then click the Save button.

Your Amazon S3 bucket that hosts the Primary-Active website is now inaccessible. When CloudFront attempts to route the user’s request to this instance, it will receive an HTTP 403 status error (Forbidden). The Distribution will automatically handle this scenario by failing over to the Passive-Secondary instance.