Git Product home page Git Product logo

automated-arc-zonal-shift's Introduction

Route53 ARC Zonal Shift

This project creates a Lambda function, an SQS queue, and an SNS Topic. The Lambda function is triggered
by a message published to the SQS queue. The Lambda function makes an API call to start Zonal Shift and sends a success or failure message to the SNS topic

ARC ZONAL SHIFT

Solution Workflow

  1. The App Server lost network access to the Database. The NLB still sees the App Server as healthy and continues to send requests to it. Client requests are failing with 5XX errors. A Gray Failure has occurred in the AZ.
  2. The Application monitoring mechanism detects the gray failure. A message is sent to the SQS queue.
  3. The SQS queue triggers a Lambda Function with information about the degraded AZ.
  4. The Lambda function makes an API call to start Route 53 ARC Zonal Shift.
  5. Route 53 ARC Zonal Shift shifts traffic from the degraded AZ.
  6. The Lambda function publishes a message to an SNS topic for notification.

Deployment Steps

  1. Ensure CDK is installed
$ npm install -g aws-cdk
  1. Create a Python virtual environment
$ python3 -m venv .venv
  1. Activate virtual environment

On MacOS or Linux

$ source .venv/bin/activate

On Windows

% .venv\Scripts\activate.bat
  1. Install the required dependencies.
$ pip install -r requirements.txt
  1. Synthesize (cdk synth) or deploy (cdk deploy) the example
$ cdk deploy

After the deployment, you should see an Output with the values for the QueueUrl and the SnsTopic. Please copy them, you will need them later.

Testing the Solution

  1. From the root directory change to src/sample.

    cd src/sample
  2. Edit the payload.json file. Change the value of elb_arn and az_id to your load balancer's Amazon Resource Name (ARN) and Availability Zone ID respectively. DO NOT change any of the Keys.

    vi payload.json
  3. Log into the AWS console, navigate to the Load Balancer page and note the status of the NLB as indicated below. Note that there is no column labelled for Zonal Shift.

    pre-shift

  4. Subscribe to the SNS topic saved from the deployment step (optional). Replace the placeholder QUEUE_URL_HERE in step 5 (below) with the value of QueueUrl saved from the deployment step.

  5. Trigger the Zonal Shift by running the command below

    aws sqs send-message --queue-url *QUEUE_URL_HERE* --message-body file://payload.json
  6. To verify the shift, log back into the Load Balancer page in the AWS Console and verify the status of the NLB. Note that new columns have appeared for Zonal Shift as indicated below. If you subscribed to the SNS topic, you will also receive an SNS notification.

    post-shift


## Cleaning Up

$ cdk destroy

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

automated-arc-zonal-shift's People

Contributors

amazon-auto avatar cobusbernard avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.