DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. Designing Web Apps for High Availability in AWS

Designing Web Apps for High Availability in AWS

Create your web applications with high availability and redundancy aspects in mind while using Amazon AWS products.

Ashan Fernando user avatar by
Ashan Fernando
·
May. 31, 18 · Opinion
Like (5)
Save
Tweet
Share
20.92K Views

Join the DZone community and get the full member experience.

Join For Free

Before the advancement of cloud technologies, building highly available web applications was considered a complex task. This is mainly due to the need for specialized hardware, middleware, and expertise which required higher costs both for development and operations.

If we consider a traditional 3-tier web application with a web server and a database server, it is suspected for single points of failures. Although it's possible to use fault-tolerant hardware, it is really expensive which makes it difficult to afford for a small business. However, it is still susceptible to scalability limitations which could potentially cause availability issues.

Image title

With the advancement of cloud computing, it is possible to build highly available applications for reasonable costs by utilizing excess capacity, elasticity, and middleware services.

The idea behind cost reduction is simple. Since cloud uses commodity hardware, the costs go down for the infrastructure with its economies of scale and automation. With elasticity and middleware services, it is possible to further reduce the costs by paying for on-demand usage with redundancy and horizontal scaling, rather than committing large servers upfront to support the peak load.

Redundancy in AWS

First of all, let us understand the level of redundancy provided by AWS. At the largest scale, there are multiple Regions with groups of data centers called Availability Zones. These Availability Zones are distant from each other (with different flood zones, using power from different grids to reduces the likelihood of multiple Availability Zone failures at a time) but connected with high-speed Wide Area Network.

It is possible to use multiple Regions to implement web applications with extremely high availability requirements but for most of the uses cases, designing web applications to span across multiple Availability Zones is sufficient.

AWS offers several services that are globally redundant, meaning that a failure of a region doesn't affect their availability. For example, Route 53 (DNS), CloudFront (CDN), IAM (Identity and Access Management) are some of the regionally redundant services.

In addition, there are regional services, which are redundant across multiple Availability Zones such as Amazon S3 (Object Storage), Amazon EFS (Network File System), Amazon DynamoDB (NoSQL),  Amazon ALB (Application Load Balancer), and are tolerant for individual Availability Zone failures.

At the Availability Zone level, there are services that are redundant within the data center cluster such as Amazon EBS (Block Storage).

As a rule of thumb, when comparing similar services, the services with higher redundancy will cost more than the ones with less redundancy. For example, if we compare storage, EBS pricing (Availability Zone Level Redundancy) with Amazon EFS (Regional Level Redundancy), EFS is costlier than EBS. However, there are exceptions where some of the redundant services are less costly or free to use, which generates indirect revenue by facilitating the provisioning of other services.

However, there are services that are not redundant by nature. For example, if we take an EC2 instance or a single instance database server, its likely that there will be a downtime due to hardware or software issues. Therefore, it is important to design the web applications for high availability, leveraging redundant services along with multiple instances of nonredundant ones.

Designing for High Availability

Let us look at how we can convert a traditional 3-tier web application with a web server and a database server to a highly available application.

First of all, it is important to identify single points of failures of the web application. In the particular case, the web server (EC2 instance) or the database server (EC2 instance or single AZ RDS) could potentially go down, affecting the overall availability of the application.

Web Server High Availability

By using an Application Load Balancer (which is highly available with the redundancy across multiple Availability Zones) along with a self-initiating fleet of web servers (EC2 instances), it is possible to make the web server highly available. With the support of Autoscaling Groups and Launch Configurations, it is possible to scale out and in automatically.

However, there are several characteristics that need to be fulfilled by the web server for high availability. One of the most important characteristics is to implement the servers statelessly or externalize the state so that any running server is able to the server any subsequent requests. It is also important to note that it is required to design the VPC with subnets spanning across multiple Availability Zones where we place the fleet of web servers, to achieve the higher level of availability without any additional costs involved. You also need to make sure that there is a health check endpoint at each web server instance so that the load balancer can decide whether to send future traffic or not based on its health. Health checks are also important for autoscaling groups to automatically provision a new instance, shutting down the faulty one.

Database Servers High Availability

If you are using regionally redundant NoSQL data storage such as AWS DynamoDB, AWS internally manages the availability of them. If we are looking at relational databases like MySQL or Postgres, it is recommended to have at least two instances of database servers (Master and Slave with active-passive high availability) which span across Availability Zones. Implementing this with EC2 will be slightly complex since its also required to synchronize the data across these instances as well as to switch to the active version via DNS when a database instance failure happens. If you use Amazon RDS for the relational database, you can enable the multi-AZ feature to implement high availability without any additional complexities.

Multi-Regional Deployment

If you have extremely high availability requirements, you can implement multiple regional deployments of the application with database synchronization across Regions (which can be tricky due to inherited latencies depending on the performance considerations).

In an event of a regional failure, switching between individual deployments in Regions can be done using DNS fail-over routing which can be configured with AWS Route53.

AWS Web Service Web server application Web apps Data (computing) Relational database app

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Asynchronous Messaging Service
  • Building a RESTful API With AWS Lambda and Express
  • [DZone Survey] Share Your Expertise and Take our 2023 Web, Mobile, and Low-Code Apps Survey
  • How To Best Use Java Records as DTOs in Spring Boot 3

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: