High Availability Approaches ( DynamoDB)

Learn via video courses
Topics Covered

Overview

DynamoDB is an AWS-managed NoSQL database. It is a serverless service, which means customers don’t have to worry about managing the servers. AWS will manage the servers and availability of DynamoDB tables. The available data in the form of a table will be copied and stored across all the availability zones within a region.

All the DynamoDB APIs are highly scalable, and the data available in the DynamoDB Table is also highly available.

Amazon DynamoDB Autoscaling in AWS has the capability of massive scaling and provides with millisecond latency response

What is High Availability?

High availability defines the level of availability of the application during the event. The event includes resource exhaustion, resource utilization, natural events, cyber-attacks, etc.

High availability also provides a solution to the concept of a single point of failure while architecting the application at an infrastructure level.

Let us consider the below scenario:

AWS Region: ap-south-1 (Mumbai)

A customer has a three-tier web application. The customer wants to achieve high availability. So she asked her cloud architect to architect the web application.

Three-tiered architecture requires three components:

  1. Web server
  2. Application server
  3. Database
  • She suggested using three availability zones, which are the maximum available availability zones in the ap-south-1 region.
  • The web server is located in three availability zones: ap-south-1a, ap-south-1b, and ap-south-1c.
  • The application server is located in three availability zones: ap-south-1a, ap-south-1b, and ap-south-1c.
  • The database server is available in three availability zones: ap-south-1a, ap-south-1b, and ap-south-1c.
  • The architecture includes EC2 instances and an elastic load balancer.
  • By utilizing a load balancer, customers can achieve request routing across the availability zone without worrying about code or routing logic.

The below diagram depicts the high availability of simple web applications.

high-availability-approaches-dynamodb-1

Advantages of Using AWS High Availability for Web Applications

  • Highly available web applications help customers serve their end-users better.
  • Highly available web applications should be able to serve massive user requests. so it should support scaling capabilities whenever required.
  • The highly available web application architecture made it mandatory for certain enterprise organizations to achieve compliance.
  • Customers can choose their deployment model in the DevOps lifecycle, such as blue-green deployment, canary deployment, etc.
  • Some AWS services such as DynamoDB Autoscaling in AWS natively support high availability at a low cost, so AWS recommends using them to improve system performance and operation.

AWS Regions and High Availability Zones

  • AWS regions represent geographical locations across the world.
  • AWS Availability Zones are the isolated data centers residing within the AWS region.
  • Essentially, each AWS region comprises a minimum of three AWS availability zones.
  • The distance between the availability zones within a region will be a minimum of 100 miles.
  • AWS will launch 30 regions with 96 availability zones around the world by 2022.
  • The majority of customers will select the AWS region that is closest to their end user.
  • AWS recommends that customers choose maximum availability zones by spanning the resources across all availability zones within a region when deploying the application in the AWS region infrastructure. This ensures the high availability of the application in the event of a natural disaster or cyberattacks in one availability zone, etc.

Reference: AWS region and availability zone

AWS Services Used to Achieve High Availability

Certain services will help customers achieve high availability natively for their customer infrastructure.

They are,

  • Compute: Elastic load balancer,
  • Databases: Amazon Multi-AZ RDS, Amazon Aurora, and Amazon DynamoDB Autoscaling in AWS
  • Storage: Amazon Simple Storage Service
  • Networking: Virtual Private Cloud, NAT Gateway, Transit Gateway, Direct Connect, and VPN connection with two tunnels enabled.

AWS Fault-Tolerant and High-Availability Architecture

Fault-tolerant and high availability are the two concepts that customers need to focus on while architecting their applications.

What is Fault Tolerance?

Fault tolerance is the ability to act when one of the system components fails. Here, the data redundancy will be less when compared to high availability.

In layman's terms, in the event of a failure in one AZ (Availability Zone), the resources in another AZ (Availability Zone) will be able to respond to the request. But those fault-tolerant mechanisms are not natively available for all kinds of AWS services.

Cloud architects should use all the necessary components in AWS to achieve fault tolerance for customer application infrastructure.

Usually, to design fault-tolerant architecture, lots of resources will be utilized, resulting in higher costs. but the end user will enjoy no service disruption or application interruption.

High-Availability Architecture

The following three components should be included in a high-availability architecture:

Using stateful and stateless components, you can achieve no single point of failure.

  1. Scalable load balancing is in place.
  2. Active and passive standby for fault tolerance
  3. Enable automation to mitigate failure.

For example,

Netflix is using a chaos monkey process to randomly terminate the production EC2 instance to test whether their operation system mechanism can mitigate the disruption by using automation.

Reference: Netflix Chaos Monkey

AWS High Availability: Compute, Databases, and Storage

  • The concept of high availability remains the same across all the services. The end goal is to make the resource as accessible and available as much as possible.
  • In AWS, the compute category contains lots of services. One of the main services that help customers achieve high availability is EC2 instances with an elastic load balancer as a front-end component.
  • AWS offers a customer-managed database as well as an AWS Managed Database in the database category. Both databases have a high availability zone.
  • In the case of customer-managed RDS, they also have the option to limit themselves to a single availability zone, which doesn’t guarantee high availability in the event of AZ (Availability Zone) failure.
  • AWS Managed RDS, known as Amazon Aurora, is natively highly available and scalable. Customers can also customize their autoscaling capabilities.
  • AWS Managed DynamoDB Autoscaling in AWS is also highly available by default. Customers can customize their autoscaling capabilities.
  • In terms of storage service, AWS is providing multiple storage options to customers to achieve high availability.
  • One of the most famous legacy services is Amazon S3. Customers can choose the standard tier while uploading files to the bucket.
  • AWS guarantees that all data in the S3 bucket with the standard tier will be available with a probability of up to 99.999999999% (11 9's).
  • Amazon Simple Storage Service (S3), Cloud Storage, and AWS. Aside from S3, the Elastic File Service is another service that guarantees data availability.

AWS High Availability for EC2 Instances

Requirement:

EC2 Instance:

  • EC2 instance in ap-south-1a
  • EC2 instance in ap-south-1b
  • EC2 instance in ap-south-1c

Elastic Load Balancer:

Application load balancer with 3 subnets in each Availability Zone (Cross Zone load balancing)

Architecture:

high-availability-approaches-dynamodb-2

  • When a customer sends a request, the request will go to the elastic load balancer.
  • The elastic load balancer will route the request to the backend EC2 instance, which is mapped to a target group.
  • EC2 instances will return the response to the application load balancer.
  • The application load balancer received the response and routed it to the customer.
  • The application load balancer will route the request across all the available EC2 instances in the target group.
  • By default, the application load balancer will route the request to the healthy EC2 instance.
  • If the EC2 instance is not healthy, the application load balancer will not route the request to the unhealthy EC2 instance.
  • Thus, the application load balancer under elastic load balancing helps customers achieve high availability.

AWS High Availability for SQL Databases on Amazon RDS

Requirements:

EC2 Instance:

Application server deployed in EC2 instances across three availability zones such as ap-south-1a, ap-south-1b, and ap-south-1c.

Relational Database Service:

Amazon MySQL RDS with multi-AZ enabled.

Amazon RDS provides five flavors of SQL databases. They are,

  1. Amazon Aurora
  2. MySQL
  3. Oracle
  4. Microsoft SQL Server
  5. PostgreSQL

high-availability-approaches-dynamodb-3

Each RDS has a slighter variation in enabling Multi-AZ. In this example, we will check the possibility of achieving high availability for MySQL RDS.

In MySQL RDS, AWS provides two options to achieve a high availability zone. They are,

high-availability-approaches-dynamodb-4

Multi-AZ DB Cluster - New

  • When customers choose this option, AWS will create one DB cluster with one primary DB instance and two readable standby database instances.
  • Here, both the standby database instances will be placed in two different availability zones.
  • This mode helps customers achieve high availability and data redundancy.

Multi-AZ DB Instance:

  • When customers opt for this option, Amazon RDS will create one primary DB instance in one availability zone and one standby database instance in another availability zone.

  • This also provides high availability and data redundancy except for support for reading capability workloads in standby DB Instances

    high-availability-approaches-dynamodb-5

AWS High Availability for Storage Services

Two storage services support high availability, data resilience, and scalability by default. They are,

Amazon Simple Storage Service:

  • By default, all the data uploaded to the S3 bucket will have a Standard tier.

  • The standard tier will store the object across all the availability zones within a region to achieve data redundancy.

  • The standard tier also provides high availability guarantees for the data residing in the bucket.

    high-availability-approaches-dynamodb-6

Amazon Elastic File System:

  • In the Elastic File System, customers can choose either standard or one zone.

  • If customers opt for standard EFS, then the data will be stored across all the availability zones, providing high availability.

    high-availability-approaches-dynamodb-7

Conclusion

  • High availability in AWS is one of the important factors all cloud architects or solution architects should consider while architecting the customer application.
  • AWS supports multiple high-availability services to serve customers according to their business needs and use cases. AWS serverless services such as Lambda and API Gateway natively support high availability.
  • AWS compute services such as EC2 and ELB(Elastic Load balancer) require some prewarming and multiple resources to achieve high availability.
  • Amazon Simple Storage Service and Elastic File Service provide high availability for the uploaded data across all the cloud service providers.
  • Amazon Relational Database Service and DynamoDB Autoscaling in AWS have a native multi-AZ option to achieve high availability.
  • Using AWS, customers can easily achieve high availability when compared to traditional on-premise computing, where all the components need to be built and managed by customers.