Microservices on AWS

Microservices on AWS: The popularity of Microservices architecture has been on rise for the last few years and in one of our blogs, we have extensively discussed what it is, how it differs from monolithic architecture, the benefits of microservices and also the challenges involved in the microservices architecture.

With the rapid advent of the cloud technologies, especially the AWS, the significance of the microservices has improved more than ever. This is because AWS seems to solve some of the very critical and innate challenges which are faced by microservices.

Microservices on AWS

The AWS ecosystem provides us with a plethora of services ranging from server provisioning to debugging services. With these services and beyond, AWS has become one of the popular platforms for the developers to design, host and manage their microservices.

There are many general offerings from the AWS cloud that aids microservices, let us have a brief look at some of those in this section:

1. On-demand resources

One of the most important offerings that AWS has is that it eliminates capacity planning fully or to a great extent. The resources/services that AWS provides can be provisioned or scaled according to need and there are no practical limitations.

Also, it enables different versions or environments to co-exist without the fear of anything going wrong.

2. Experiment with low cost and risk

Most of the services and resources offered by AWS are cost efficient as we need to pay only for what we use. Adding to this, the majority of the services have a free tier.

Clubbing these together, developers can innovate at great speeds. This eliminates the huge cost and failure risks totally and facilitates the faster discovery of solutions.

3. Programmability

Another big feature from AWS is the programmability it offers to provision/operate/scale almost all of its services/resources. This means that we can clone an entire application running on dev and deploy it in scale in an entirely different environment, with a single config file. How awesome is that?. Yes, this solves the operational complexity overhead of the microservices with grace.

4. Continuous Delivery

Since the provisioning and deployment can be made automated, it is even more good whether this can be linked to the development side too. With AWS this is possible and this further reduces the operational complexity.

5. Managed services

The managed services in the AWS adds even more value since the services are not only managed for what they do, but they are also managed for performance, optimisation, monitoring, scalability and numerous others. This makes the usage of these services effortless and trouble-free.

6. Service orientation

Every AWS service has well-defined APIs, which would make sure that all aspects of the service is very well covered. This makes sure that applications using these services won’t crash/misbehave when used with other services, that too in complex architectures.

7. Polyglot

AWS has a huge repository of services, for eg, at the time of writing this, AWS alone has 6 flavours of Relational Database each optimised to specific use cases, also it has numerous variants of virtual machines for the user to choose.

Combined with these huge infrastructure and services pool, the AWS SDKs comes in almost all the languages. This makes it an efficient platform supporting a large variety of developmental tools and practices, which is not only ideal but also a nurturing environment for microservice applications.

Basic Microservices architecture on AWS

Now let us discuss a basic serverless microservices architecture in AWS and its components. The following diagram represents a basic microservice architecture on AWS.


Let us explore each component and the purpose of each from the above architecture:

1. Cloudfront

Cloudfront is a global content delivery network provided by Amazon. It can be used for hosting content, like static websites etc. Depending on the access location of the client of a microservice, the cloudfront would deliver the content from the nearest location. This will significantly reduce the latency. Cloudfront can be configured to get the contents from S3 (simple storage service), another Amazon service for storage.

2. API Gateway

API Gateway is a fully managed service from Amazon, which makes creating, publishing, managing, securing and monitoring the APIs easier at any scale. What this practically

means is that the limitations when we face while defining the APIs across the microservices is fully solved. Let us see how.

The most important difficulty, in the API front, when we are working with the microservice architecture is that, the structuring of APIs. There might be different teams working on different individual services and these teams are to be informed whenever there is a change.

API documentation has to be made on the change and everyone should be noticed. This overhead is completely non-existent in API gateway as whenever there is a change in the API structure, the individual teams can be notified automatically.
Now other issues like API response caching, access authentication, etc can be handled easily and centrally using API Gateway.

3. Cloud watch

AWS is a monitoring service which can be used to monitor the applications/services wee run on AWS. Cloud watch can be configured to collect metrics and generate dashboard based on these metrics so that we can have a good idea of the state/performance of our applications/services.

In the microservices context, this is of great help as we can monitor each individual service/metric and tag them. In the above picture, API metrics like request time, response time etc are logged into CloudWatch and thus we can have an idea of the API performance

4. Lamda

AWS Lambda is one of the most important and useful services in the AWS world. This essentially eliminates the need for a server to run your code (of course, it has its limitations on the run time etc). It makes the running of the backend code for any application with zero administration from our side.

Both Lambda and API Gateway are highly integrated with each other.  We can make API Gateway to trigger Lambda functions which in turn has the ability to pass the response back to the API Gateway or to trigger other services.

AWS Lambda charges only pay per use policy after a significant free tier usage. This also helps the developers to experiment a lot with it.

Deploying the application

AWS also takes care of the deployment of the applications. In a real-world application, there will be a lot more AWS services and resources to form a microservice application. CloudFormation is a service that will help in modelling and the setting up of the AWS resources.

This helps in saving time by minimising the need for configuration/management to a very small extent from the developer’s part. The configurations and others are stored in a CloudFormation template, which can be used for provisioning multiple instances of the same microservices application with any number or AWS resources/services

Addressing key challenges in Microservices

In the previous section, we saw a simple microservice implementation architecture, which was intended for the basic understanding of the microservices deployment in AWS. In this section, we will see, in brief, the different issues faced by microservices in scale and the AWS solution for them. Each solution by itself can generate the content for individual articles, hence I am discussing only the bare minimum to make you aware of the solution:

1. Service discovery

The most widely existent challenge in a microservices architecture is the discovery and interaction between services. This can happen in the following scenarios like health monitoring reports for between services, or if a new service comes in to the system. AWS presents several small scale to large scale robust solutions for the same, such as
a. Service discovery using load balancers

b. Service discovery by DNS lookup, employing Route53 service

c. by using AWS ECS event stream service

d. Service discovery employing AWS service called OpWorks for configuration management.

e. Service discovery using DynamoDB as a key-value store with appropriate triggers.

2. Distributed data management

Other major concern is the distributed data management amongst the different services in a microservice. One of the most popular architecture to handle this involves the use of AWS Kinesis service in an event sourcing manner. Kinesis Streams can continuously capture and store huge amounts of data per hour from a large number of sources, social media feeds, logs, location-tracking events and financial transactions. The data published by a microservice can be made available to any or all of the other services involved in the application.

3. Distributed Monitoring

Monitoring of hugely distributed services is a pain for most of the teams. AWS has some very good and stable solutions for the monitoring of distributed services.
AWS X-Ray service is one of the most common debugging/monitoring used to debug/monitor applications in AWS. It simply shows us visually the connections between the services. This can be extended using the tagging of AWS services/resource to the corresponding microservice and generating the connections.

Cloudwatch is another common tool, which was discussed earlier. Tagging the services with cloudwatch also will help us in the monitoring of the services.

The cloudwatch logs can be fed to the Amazon Elasticsearch service which can be used to analyze the logs. Amazon Elasticsearch service also makes the logs searchable. The findings can then be visualised using the Kibana service that comes along with the Elasticsearch service.

Another alternative is to pass the Cloudwatch logs to the Amazon Kinesis Firehose service and which store the logs into the Redshift database service and then visualise these logs using the Amazon Quicksight.

4. Auditing

According to Amazon “ CloudTrail is a web service that records AWS API calls for your account

and delivers log files to you. This includes those taken on the AWS Management Console, the AWS CLI, SDKs, and calls made directly to the AWS API.”

This essentially logs every detail of related activities in great depth, that the resulting logs can be used as audit trails. These are then fed to Elasticsearch/Redshift as we saw in the monitoring section.


We have seen the basic features of the AWS cloud infrastructure which aids the provisioning and deployment of microservices. Also, we have discussed a basic architecture of a microservice implemented in AWS with its significant components. The scaling challenges and how AWS services or solutions address them were also discussed in this article.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>