Build Microservices for Production
Microservices are an architectural and organizational approach to software development where software is composed of small independent services that communicate over well-defined APIs. These services are owned by small, self-contained teams.
Microservices architectures make applications easier to scale and faster to develop, enabling innovation and accelerating time-to-market for new features.
From Monolith to Microservices
With monolithic architectures, all processes are tightly coupled and run as a single service. This means that if one process of the application experiences a spike in demand, the entire architecture must be scaled. Adding or improving a monolithic application’s features becomes more complex as the code base grows. This complexity limits experimentation and makes it difficult to implement new ideas. Monolithic architectures add risk for application availability because many dependent and tightly coupled processes increase the impact of a single process failure.
With a microservices architecture, an application is built as independent components that run each application process as a service. These services communicate via a well-defined interface using lightweight APIs. Services are built for business capabilities and each service performs a single function. Because they are independently run, each service can be updated, deployed, and scaled to meet demand for specific functions of an application.
Breaking a monolithic application into microservices
Characteristics of Microservices
Each component service in a microservices architecture can be developed, deployed, operated, and scaled without affecting the functioning of other services. Services do not need to share any of their code or implementation with other services. Any communication between individual components happens via well-defined APIs.
Each service is designed for a set of capabilities and focuses on solving a specific problem. If developers contribute more code to a service over time and the service becomes complex, it can be broken into smaller services.
Benefits of Microservices
Microservices foster an organization of small, independent teams that take ownership of their services. Teams act within a small and well understood context, and are empowered to work more independently and more quickly. This shortens development cycle times. You benefit significantly from the aggregate throughput of the organization.
Microservices allow each service to be independently scaled to meet demand for the application feature it supports. This enables teams to right-size infrastructure needs, accurately measure the cost of a feature, and maintain availability if a service experiences a spike in demand.
Microservices enable continuous integration and continuous delivery, making it easy to try out new ideas and to roll back if something doesn’t work. The low cost of failure enables experimentation, makes it easier to update code, and accelerates time-to-market for new features.
Microservices architectures don’t follow a “one size fits all” approach. Teams have the freedom to choose the best tool to solve their specific problems. As a consequence, teams building microservices can choose the best tool for each job.
Dividing software into small, well-defined modules enables teams to use functions for multiple purposes. A service written for a certain function can be used as a building block for another feature. This allows an application to bootstrap off itself, as developers can create new capabilities without writing code from scratch.
Service independence increases an application’s resistance to failure. In a monolithic architecture, if a single component fails, it can cause the entire application to fail. With microservices, applications handle total service failure by degrading functionality and not crashing the entire application.
The Most Complete Platform for Microservices
AWS has integrated building blocks that support any application architecture, regardless of scale, load, or complexity.
Processing power for microservices.
Amazon Elastic Container Service
A highly scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances.
Learn More »
AWS Lambda lets you run code without provisioning or managing servers. Just upload your code and Lambda manages everything that is required to run and scale your code with high availability.
Learn more »
Storage & Databases
Scalable, durable, and secure data storage.
Amazon ElastiCache improves service performance by allowing you to retrieve information from fast, managed, in-memory caches, instead of relying entirely on slower disk-based databases. Learn More »
Amazon S3 provides developers and IT teams highly reliable, secure, and scalable object storage for all of their data, large or small. Learn More »
A fully managed, fast, and flexible NoSQL database service for all applications that need consistent, single-digit, millisecond latency at any scale. Learn more »
Easily setup, operate, and scale a relational database in the cloud. Choose from six familiar database engines, including Oracle, Microsoft SQL Server, PostgreSQL, MySQL and MariaDB. Learn more »
A relational database engine that combines the speed and reliability of high-end commercial databases with the simplicity and cost-effectiveness of open source databases. Deliver up to 5x the throughput of standard MySQL running on the same hardware. Learn more »
Networking services with high-throughput and sub-millisecond latency.
Amazon API Gateway
Amazon API Gateway allows you to process hundreds of thousands of concurrent API calls and handles traffic management, authorization and access control, monitoring, and API version management.
Learn more »
Amazon Route 53
Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service that effectively connects requests to infrastructure that is running in AWS. It can be used for IP health checks and service discovery for microservices. Learn more »
Elastic Load Balancing
Application Load Balancer
The Application Load Balancer load balances HTTP and HTTPS traffic at the application layer (level 7) providing advanced request routing that is targeted at the delivery of modern application architectures, including microservices and containers.
Learn More »
Elastic Load Balancing
Network Load Balancer
The Network Load Balancer offers high performance load balancing that operates at the network connection layer (level 4) and allows you to route connections to microservices based on IP protocol data. The Network Load Balancer can handle millions of requests per second while maintaining ultra-low latencies. Learn more »
Publish and coordinate inter-process communications.
Message Publishing & Subscription
Amazon Simple Notification Service (Amazon SNS)
Amazon SNS is a fully managed pub/sub messaging service that makes it easy to decouple and scale microservices, distributed systems, and serverless applications.
Learn more »
Amazon Simple Queue Service (Amazon SQS)
Amazon SQS is a fully managed message queuing service that makes it easy to decouple and scale microservices, distributed systems, and serverless applications.
Learn more »
Logging and Monitoring
Monitor service performance and resource utilization. Trace across complex architectures for troubleshooting and optimization.
With CloudTrail, you can log, continuously monitor, and retain account activity related to actions across your infrastructure. CloudTrail event history simplifies security analysis, resource change tracking, and troubleshooting. Learn more »
Application and Resource Monitoring
Use Amazon CloudWatch to collect and track metrics, collect and monitor log files, set alarms, and automatically react to changes across your running services and AWS resources.
Learn more »
Get an end-to-end view of requests as they travel through your application and see a map of your application’s underlying components. As a set of microservices works together to handle a request, AWS X-Ray can provide a centralized view of logs, allowing you to monitor and troubleshoot complex interactions. Learn more »
Manage the code lifecycle from commit to run.
Container Image Repository
Amazon Elastic Container Registry (Amazon ECR)
A fully managed Docker container registry that you can use to store, manage, and deploy Docker container images. Amazon ECR is integrated with Amazon Elastic Container Service (Amazon ECS), simplifying development to production workflow for containers. Learn more »
AWS Developer Tools
AWS Developer Tools is a set of services that enable developers and IT operations professionals practicing DevOps to rapidly and safely deliver software. Together, these services help you securely store and version control your application’s source code, and automatically build, test, and deploy your application to AWS or your on-premises environment. Learn more »
Look also at AWS Fargate
AWS Fargate is an easy way to deploy your containers on AWS. To put it simply, Fargate is like EC2 but instead of giving you a virtual machine you get a container. It’s a technology that allows you to use containers as a fundamental compute primitive without having to manage the underlying instances. All you need to do is build your container image, specify the CPU and memory requirements, define your networking and IAM policies, and launch. With Fargate, you have flexible configuration options to closely match your application needs and you’re billed with per-second granularity.