February 25, 2018Building Serverless Microservices on AWS
Microservices has been a key trend in software architecture. Let’s discuss what microservices are and what is Microservices Architecture.
I’ll give you the standard definition of Microservices Architecture, first.
The idea of microservices architecture is to take a large complex system and break it down into independent decoupled services that are easy to manage and extend.
Microservices are an approach to software development where software is composed of small, independent services that communicate over a well-defined API. These services are generally owned by small self-contained teams.
Microservices architecture makes your applications easier to scale and faster to develop, enabling innovation and accelerating time to market for new features.
Each service performs a single specific function and because they’re independent of each other, they can be run, deployed, updated independently to meet the demands of your application.
Main Characteristics of Microservices
Microservices have two specific characteristics.
- they’re autonomous, and
- they are specialized
‘Autonomous’ means each service can be deployed, developed, maintained, and updated independent of other services, and without affecting the functionality of other services. These services also do not share their code or implementation with other services. They simply communicate over well-defined APIs.
‘Specialized’ means each service performs a single specific function. If developers add more code to a service over time making it complex, it can then be broken down into smaller services.
Benefits of Microservices
Now let’s discuss some of the benefits of using microservices.
- First is Agility. Microservices promote an organization of small, independent teams, that take ownership of their services. This shortens the development cycle times.
- Second is flexible scaling. Microservices can be independently scaled, providing fine-grained control of infrastructural needs. Then, we have easy deployment. Microservices support Continuous Integration and Continuous Delivery, making it easy for you to try out new ideas.
- Then, we have technological freedom. You have the freedom to choose your programming language and your tools, to develop your services to solve your specific problems. Then, we have reusable code. A service that is written for a specific function can be used as a building block for another feature. This allows the application to bootstrap off itself, as developers can create new functionality and new capability without writing code from scratch.
- Lastly, we have Resilience. Service independence increases your application’s resistance to failure. With microservices, applications handle total system failure by degrading functionality and not by crashing the entire system.
AWS Serverless Microservices
No server is easier to manage than no server – @Werner #reInvent pic.twitter.com/qAYvOuFv19
— AWS re:Invent (@AWSreInvent) October 8, 2015
“No server is easier to manage than no server”. Serverless drastically simplifies operational overhead of your application. AWS Lambda and API Gateway provide that perfect combination of web services that you can use to build, deliver, and maintain a set of microservices that in turn form your complex serverless application.
Let’s quickly understand how AWS Lambda and API Gateway can help. AWS Lambda enables you to run your code without having to manage any servers. You simply upload your code to Lambda and Lambda takes care of the rest, enabling your application to run on highly-available and highly-scalable infrastructure. Each piece of code that you upload to Lambda is called as a Lambda Function, and it runs as an independent, self-contained microservice.
API Gateway allows you to expose your code running in AWS Lambda in the form of RESTful APIs. RESTful APIs are the APIs that follow a client-server model, where client is stateful but server is completely stateless. Again, API Gateway is a fully-managed service and can support thousands of concurrent API calls. It also allows you fine-grained access control and version management capabilities. These APIs can then be consumed by your mobile, web or IoT applications, allowing you to interact with different AWS services through your code running in AWS Lambda.
You can learn more the AWS approach to Microservices by reading this whitepaper: Microservices on AWS.
If you’d like to learn more about Serverless Computing using AWS Lambda, I talk more about this and take you through intensive hand-on labs in my new online course AWS Lambda & Serverless Architecture Bootcamp. This 25+ hours long course might just be the only course you’ll ever need to master AWS Lambda and Serverless Computing. But don’t just take my word for it. Preview the course and find out for yourself.
Subscribe to my YouTube Channel if you’re interested in more informative write-ups like these in the future!