Achieving High Availability and Scalability in AWS: Best Practices for Modern Cloud Architectures
Boosting Cloud Performance: High Availability and Scalability Tips for AWS
In today’s computing industry these two terms you have heard a lot or you have heard the term how to achieve zero downtime which is very crucial in application and business needs. In this article, we will be learning about High Availability, and Scalability and how we can achieve this in Cloud Modern architectures (AWS).
By keeping our system highly available and scalable our business would grow more and our end-users would be more happy. These two terms are most asked questions on System Design Interview by big tech companies (FAANG) so it is good to know these two terms in detail and in AWS cloud perspective.
Before heading to Introduction section, do read my latest blogs:
Building a Serverless Web Application with AWS Lambda, API Gateway, DynamoDB, S3
End-to-End DevOps for a Golang Web App: Docker, EKS, AWS CI/CD
Deploying Your Website on AWS S3 with Terraform
Learn How to Deploy Scalable 3-Tier Applications with AWS ECS
High Availability
As a DevOps Engineer, our end task is not deploy the only application to the Kubernetes cluster, or on AWS services but to ensure that the system is available every time to the end-user. So, to keep the system available we need to make the system highly available.
To measure high availability we need to keep the system’s percentage in five 9’s means if the system’s or application has 90% then the system is down for 36.5 days which is very bad for the end-user or if the system has 99.999% then system will be down for 6 minutes a year which has become standard for achieving the HA for most the companies. Remember any system would not be 100% available.
To understand this in a better way, let’s take an example of grocery store which is running 24/7. After some-day the grocery store needs an maintenance so he shuts down the grocery store which means that the grocery store would not be available for few days which results in business loss. So to keep the business running every time, what store owner did he opens another grocery store in nearby so that if any customer comes he/she can go to another grocery store during maintenance of another grocery store which keeps the business running smoothly and by this whenever any sales comes like Black Friday the crowd is distributed to 2 stores.
By this it ensures the business continues to operate without interruptions, which is the essence of High Availability.
Now, let’s understand this in terms of AWS cloud perspective.
This picture is AWS architecture, which depicts the High Availability on AWS.
Let’s understand the previous example of grocery store in AWS terms.
- Multiple Stores (Redundancy) → AWS Availability Zones (AZs)
Like operating the grocery stores in multiple locations keeps the business running smoothly. In AWS we had to deploy the infrastructure in multiple AZ’s (Availability Zones).
If one AZ fails in AWS like our one store goes in maintenance the other store is operating likewise the other AZ will be working to handle customer’s workloads.
Spreading Demand Across Stores (Load Balancing) → Elastic Load Balancer (ELB)
Like the festival came Black Friday so the crowd is distributed on 2 stores meanwhile in AWS we use Load Balancing to distribute the traffic efficiently so that one server has not the most requests.
Shared Inventory (Centralized Data) → Shared Databases or S3
In grocery store it uses the centralized data to keep the stocks updated for every store. Likewise in AWS we use database to keep our data safe, secure and highly available by deploying AWS RDS with Multi-AZ feature or DynamoDB.
Restocking (Scaling) → Auto Scaling
Just like when any festival season came users increased to buy items which results in huge spikes in users. In AWS to manage the traffic to scale efficiently Auto Scaling is the feature that scale the workload by setting Auto Scaling Groups on AWS so that when the users increases the workloads increased when the user decreases the workload comes to an normal state which also results in cost optimization.
Delivering Popular Items Globally (Global Content Delivery) → CloudFront
CloudFront is the feature in AWS which enables the static content to make available to every user that is distributed globally. With the help of CDN (CloudFront) it ensures there no downtime to end user to accessing any static website.
Scalability
Now, let's talk about scalability. It's all about how a system or an application can handle more or fewer resources without losing performance, reliability, or availability. Basically, it's about keeping things running smoothly no matter how much you throw at it.
There are 3 types of scalability:
Vertical Scalability:
Vertical Scalability means scaling UP and scaling DOWN which means increasing the capacity of the single resource.
Horizontal Scalability:
In this type of scalability, means scale IN and scale OUT means to increase the resources, multiply the resource adding more servers.
Elastic Scalability:
In AWS by defining AutoScaling we can achieve the elastic scalability to dynamically adjust the resources based on real-time demands.
Now, let’s understand the grocery store example in terms of scalability in AWS perspective.
Adding More Cashiers (Vertical Scaling):
Like in festive season in High Availability we had increased the stores which balances the crowd. Now, in terms of scalability (Vertical Scaling) we need to increase the capacity to handle more people in the stores. So, we increased cashiers to handle vertical scaling but in terms of AWS in EC2 service we increase the capacity from
t2.micro
tom5.large
.Opening More Stores (Horizontal Scaling):
To handle more people not to make the crowd overloaded in one store we opened the another store to handle the crowd efficiently. This what makes horizontal scaling. In AWS we can increase the EC2 instances by setting ASG (Auto Scaling Groups) to increase the workloads based on traffic demands.
Temporary Staff (Elastic Scaling):
During the busy season, the store hires extra workers and opens another locations. Once the festival season ends, they return to their normal staff levels. In AWS this also done by Auto Scaling which dynamically adds resources based on real-time that saves the cost.
Scaling Data and Storage
Now, to prevent running out of stock for grocery stores we had to keep the stocks available 24/7 for this in AWS that manages the scaling storage and databases:
Amazon RDS with Read Replicas: It add the replicas to distribute database read traffic with Multi-AZ feature.
Amazon S3: Automatically scales to store unlimited amounts of data.
Conclusion
In this article, we learned about High Availability and scalability how to achieve this in AWS cloud. These two are essential pillars in building the resilient system and fault-tolerance that ensures the minimal downtime or zero downtime. In upcoming posts, we will delve into the creation of various AWS services, DevOps tools, CNCF tools and their automation with Terraform and also do projects with DevSecOps approach. Stay tuned for the next blog!
GitHub Code : github.com/amitmaurya07
LinkedIn : linkedin.com/in/amit-maurya07
If you have any queries you can drop the message on LinkedIn and Twitter.