Amazon just saved 90% on Operating Costs!

Abhishek Attri
4 min readMay 10, 2023

Why Microservices Aren’t Always the Answer | Prime Video Case Study

Image source: https://www.indellient.com/

Amazon Prime Video’s recent decision to switch from a serverless, microservices architecture to a monolith has caused a stir in the developer community. This move saved them a whopping 90% on operating costs and made the system easier to use. But why did the Prime Video team choose this and what can we learn from this?

A brief understanding of the AWS services in the picture

(a) Amazon Step Functions is a fully managed service that enables users to create serverless workflows by utilising visual workflows and state machines. Users can use Step Functions to define and orchestrate complex workflows that integrate with other AWS services such as Lambda, EC2, and S3. Workflows are defined with JSON or YAML templates and can be triggered by events from other AWS services or from outside sources.

(b) Amazon Elastic Compute Cloud (EC2) is a cloud computing service that provides scalable computing capacity. Users can use EC2 to launch and manage virtual machines, known as instances, in the cloud. Users only pay for the capacity they use when using EC2 instances, which can be configured with a variety of operating systems, applications, and network configurations.

(c) Amazon Simple Storage Service (S3) is a cloud-based object storage service that offers scalable cloud storage. S3 is built to be extremely long-lasting, available, and secure, and it can be used to store and retrieve any amount of data from anywhere on the internet.

(d) Amazon Elastic Container Service (ECS) is a fully managed container orchestration service that makes it simple to start, stop, and manage Docker containers on an EC2 cluster. ECS removes the need to install and manage your own container orchestration software and integrates with other AWS services such as Elastic Load Balancing, Auto Scaling, and IAM.

The Target Application

There was a need for a monitoring tool that could find quality problems in every stream viewed by customers. Since there are thousands of concurrent streams, the tool had to be very scalable. At first, the team made a solution with parts that were spread out and put together by AWS Step Functions, which is a serverless orchestration service based on state machines and tasks.

The Real Problems

(a) Soon Step Functions turned out to be a bottleneck. The service performed multiple state transitions for every second of the stream, so it quickly reached AWS account limits, hence exhausting the step function quotas. A quota is a predefined limit or restriction on the number of resources or operations that a user or account can perform in a given time frame. The quotas are in place to prevent resource mismanagement or overconsumption, maintain system performance, and ensure a fair distribution of resources among all users.

(b) There was also a cost problem with the high number of tier-1 calls to the S3 bucket used for the temporary storage of captured video frames. The cost of using Amazon S3 (Simple Storage Service) depends on various factors, such as the amount of data stored, data transfer in and out of S3, and the number of requests made.

The Bold Solution

The team decided to switch from their initial distributed solution with serverless components to a monolithic architecture to overcome the above issues. They packed all components into a single application running on EC2 and ECS, hence eliminating the need for S3 as the data can persist locally on the same servers(or volumes). A lightweight orchestration layer to distribute customer requests was also added. Since the move to a monolith got rid of the need for S3, infrastructure costs went down by more than by around 90%!

Major Takeaway

The Amazon case study shows that microservices and serverless components are useful tools for high scalability, but they aren’t always the best choice. The choice of whether to use microservices or a single big piece of code should depend on the application’s architecture and use case. Microservices may have their place in today’s Saas world, but it’s important to think carefully about the pros and cons of all possible architectures.

Thank you for taking the time to read my article! I hope you found it informative and valuable. If you have any feedback, comments, or questions, please feel free to reach out 😄
I look forward to sharing more content with you in the future! 🤘

--

--

Abhishek Attri

Animal lover ❤️ DevOps & Cloud enthusiast 🖥️ Always learning and fascinated by technology🕹️. Glad to connect! 🤝👇 https://www.linkedin.com/in/abhishek-attri/