Have you been looking for a simple way to implement high availability for your web application? Amazon Web Services provides the entire foundation for achieving true high availability, but implementing the features properly requires specific knowledge of how to bring each service together.
In this article, I’ll explain the concept of high availability and how to leverage infrastructure as code (IAC) tools such as Cloudformation to achieve it. AWS Cloudformation can help you achieve high availability for cloud workloads, across compute, SQL databases and storage services. For this article, I deployed a simple web app using a CloudFormation template.
This template deploys a VPC, with a pair of public and private subnets across two Availability Zones. It deploys an Internet Gateway, with a route on the public subnets. It deploys a pair of NAT Gateways (one and default routes for them in the private subnets.) It deploys Security groups for an Ubuntu launch configuration, Auto-Scaling group, Load Balancer, Target Group with Listener and Listener Rule.
High availability is the ability of a workload to remain operational, with minimal downtime, in the event of a disruption. Disruptions include hardware failure, networking problems or security events, such as DDoS attacks.
In a highly available system, workloads are spread across a cluster of servers. If one server fails, the workloads running on it automatically move to other servers.
High availability means that a system will almost always maintain uptime, albeit sometimes in a degraded state. With regard to AWS, a system has high availability when it has 99.999% uptime, also known as “five nines”. To put that in perspective, the system would be down for a mere five minutes and fifteen seconds a year.
And yes, that is possible — and even routine — for AWS.
AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment. It allows you to use a simple text file to model and provision, in an automated and secure manner, all the resources needed for your applications across all regions and accounts.
Consider the script in the screenshot below.
The script applies a launch configuration which is used by an Autoscaling group to deploy a basic Apache web server hosted on an EC2 instance in two private subnets of two different availability zones. This is to guarantee that our application remains up and running even when one AZ goes down. Public traffic is allowed via a Load Balancer deployed on the public subnets.
Thank you for reading through this article. Got questions? Put them in the comment section.