Microservices architecture on AWS

We have discussed the microservices architecture and its benefits in previous chapters of this book. In this section, we will discuss the microservices architecture on AWS and how to use several Amazon services to provide better cloud-native solutions to a microservice-based distributed application. The following diagram illustrates the simple microservice architecture on AWS:

In the preceding diagram, the microservices-based application architecture is designed with four layers, Content Delivery, API Layer, Application Layer, and Persistence Layer.

AWS provides several services for each aspect of the application, such as the frontend (user interface), and the backend, such as the service layer and persistence layer. In the frontend layer of the application, services are required to manage static content, such as scripts, images, CSS, and so on, and dynamic content, such as rendering web pages. Services such as Amazon Simple Storage Service (Amazon S3) and Amazon CloudFront are used to serve static web content.

AWS CloudFront is an AWS service used to manage content for your websites and APIs, such as video content and other web assets. It is a global content delivery network (CDN) service used to accelerate static content delivery.

AWS services such as Amazon S3 and Amazon CloudFront provide solutions for static and dynamic content and are used to accelerate the delivery of content. The Amazon S3 service is used to store static content, such as images, CSS, JS, and so on. And Amazon CloudFront delivers this static content. The REST API uses microservices to serve dynamic content for the frontend. To reduce the latency of networks, we can use other caching mechanisms.

The API layer is an abstract layer for the application layer. This layer hides application logic from the content layer. This layer serves all requests coming from the content layer using the HTTP REST API. Amazon Elastic Load Balancing has used it to manage and distribute traffic. This API layer is also responsible for client request routing, filtering, caching, authentication, and authorization.

Amazon ELB is used to manage and distribute incoming application traffic across multiple Amazon EC2 instances.


At the persistence layer, you can configure data storage, such as caching (Memcached or Redis), NoSQL DB, or SQL DB. AWS also provides Relation DB support, such as Amazon RDS. The Amazon ElastiCache service is used to manage caching mechanisms.
The application layer has actual business logic to connect the persistence layer and caching, and this layer is also used by ELB to scale EC2 instances and manage incoming traffic from the API layer.

Let's look at another typical microservice architecture on AWS. In the previous architecture, we have used different layers, such as the content delivery layer, API layer, application layer, and persistence layer. In the microservice architecture, we divide an application into separate verticals based on the specific functionality rather than technological layers. The following diagram illustrates another aspect of a microservices application on AWS:

So, as you can see in the preceding diagram, the User interface is very similar to the content delivery layer in the previous diagram. It serves static content using the Amazon S3 service.

In this architecture, I have used Amazon ECS (EC2 Container Service) to run the application using containers. This service supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances.

You can also scale the Amazon ECS depending on incoming traffic from the client. Amazon ELB can be used to manage the incoming traffic across these containers, and it distributes the traffic to Amazon ECS container instances running REST APIs.

Amazon ECS eliminates the specific requirement for the infrastructure of your application in this architecture of AWS. You can use container-based approach technologies, such as Docker, for deploying the services. We have discussed several benefits in Chapter 12, Containerizing Microservice.

Similar to the persistence layer in the previous diagram, we can use several data stores, such as Amazon RDS and Amazon ElastiCache, to persist data needed by the microservices. Amazon ElastiCache is used to optimize application performance by using an in-memory data store or cache in the cloud. It is easy to deploy, operate, and scale.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset