DEV Community

Cover image for AWS Services for Microservice Architectures: A Beginner's Overview (Part 1 - Computing)
Edris Temori
Edris Temori

Posted on

AWS Services for Microservice Architectures: A Beginner's Overview (Part 1 - Computing)

In today's rapidly evolving tech landscape, microservices have become a cornerstone for building scalable and maintainable software solutions. Leveraging the right tools and services is crucial for effectively implementing a microservice architecture, and AWS offers a comprehensive suite of services tailored to meet these needs. In this part, we will be delving into the AWS services you can use for actually running your application with a microservice architecture.


What are Microservices?

Microservices are a fundamental component of many modern software solutions. They facilitate an approach in which software is composed of small, independent services that communicate over lightweight APIs. Unlike monolithic architectures, where all processes are tightly coupled and run together, each microservice performs a single function and is ideally owned by a small, self-contained team.

Adopting a microservice architecture offers several benefits, such as:

  • Easier scaling of applications: Individual services can be scaled independently based on demand.
  • Improved technology choice, code quality, and readability due to separation of concerns: Teams can choose the best technologies for each service.
  • Isolated deployments and rollbacks: Changes to one service do not affect the entire application, reducing risk and improving deployment flexibility.

Running microservices with AWS

AWS provides four major managed services that can be used to supply the computing power needed to run microservices:

Amazon Elastic Container Service (ECS)

Image description

ECS is a container management service that runs code within Docker containers. You can run your applications on a managed cluster of Amazon Elastic Compute Cloud (EC2) instances or opt for AWS Fargate if you prefer a serverless approach.

Amazon EC2 provides computing capacity in the form of virtual servers that can run one or more containers. EC2 requires you to configure server instances according to your application's needs. There are various instance types to choose from, each with its own technical specifications and price points. For instance, a t3.nano instance with 0.5 GiB of memory currently costs $0.0052 per hour, while a t3.large instance with 8 GiB of memory is currently priced at $0.0835 per hour.

AWS Fargate is a serverless option, meaning you don't need to manage any virtual servers to run your containers. Many scaling and configuration related processes are handled automatically, but you still need to configure certain aspects of your application deployment. For example, you may need to set up auto-scaling policies based on specific metrics to ensure your application can handle varying levels of traffic. Similarly, you might need to configure load balancing to distribute incoming traffic across multiple container instances for high availability and performance.

Generally speaking, Fargate is less complicated to set up and maintain compared to EC2, but it is also slightly more expensive per hour for the same computing power. EC2 instances are ideal for scenarios where the team requires granular control over container instances, networking, and storage. Given a stable workload, it is possible to optimize costs using EC2 instances. Conversely, EC2 instances are often only partly utilized, rendering some of the resources you pay for superfluous. Fargate, on the other hand, only uses the application's actual computing needs, ensuring you only pay for what you use.

ECS is an excellent choice for a managed container service and is used in many projects worldwide. It is suitable for long-running processes (such as web pages that need to be available around the clock) and is ideal for teams with Docker expertise.

Amazon Elastic Kubernetes Service (EKS)

Image description

EKS is a Kubernetes service for building, securing, operating, and maintaining Kubernetes clusters. It integrates seamlessly with core AWS services, providing monitoring, scaling, and load balancing capabilities for containerized applications. Like ECS, the computing power for EKS can be provided through EC2 instances or AWS Fargate.

EKS is best for teams already invested in Kubernetes and wanting to leverage Kubernetes tooling and community support. It is also ideal for applications that need advanced orchestration features.

AWS Lambda

Image description

Lambda is a fully managed, serverless solution similar to AWS Fargate. You just upload your code, and Lambda manages everything required to run and scale it.

An important aspect of Lambda is its event-driven nature. This means your code is executed in response to specific events, such as API calls, file uploads, or scheduled time intervals.

Lambda is a great choice if you want to go for an event-driven architecture and microservices that require minimal infrastructure management. It is also well-suited for applications that need to scale quickly due to large spikes of traffic at unexpected times. Lambda provides 1 million free requests and 400,000 GB-seconds of free compute time per month, making it a cost-effective option for smaller projects or lightweight jobs like resizing images for thumbnails.

AWS App Runner

Image description

App Runner is a fully managed service that simplifies the deployment of containerized web applications and APIs, requiring no prior experience. Its primary aim is to eliminate the complexities of infrastructure management, enabling developers to focus solely on building and deploying their applications. Powered by AWS Fargate, App Runner requires even less configuration compared to direct usage of Fargate. It offers hands-off scaling, includes a built-in load balancer and provides HTTPS Support, amongst other features.

Due to the additional features, using App Runner tends to be more expensive than the previously mentioned services. Its ability to automate scaling entirely, however, makes it a perfect fit for applications that do not receive traffic at all times. An example of this is a development environment that is only used during business hours. This way, one benefits from the streamlined deployment process while benefiting from automatic savings during the times the application is inactive.


Conclusion

As we've explored the AWS services tailored for running applications with a microservice architecture, it's evident that each service brings its unique advantages to the table. Whether it's the granular control of EC2 instances, the simplicity of Fargate, the orchestration capabilities of EKS, the event-driven nature of Lambda, or the streamlined deployment process of App Runner, AWS caters to diverse needs and preferences. I hope this post has proven useful in helping you get an overview of these technologies. If you are interested in learning more, I have included some links below.

Stay tuned for part 2 where I'll be addressing the topics of database and storage in AWS!


Further Reading

Top comments (0)