Articles/Engineering/ Maximizing Efficiency and Minimizing Costs with Serverless Architecture
Cover Image

Maximizing Efficiency and Minimizing Costs with Serverless Architecture

7 minute read

A visual depiction of what is being written about

What do companies love the most? Having an infinitely scalable system that can handle thousands of users from Day 1, a team of developers that works and ships features fast, and not paying boatloads of money for infrastructure.

Leveraging your infrastructure using Serverless Architecture is possible in many cases. Let’s cover the key aspects of Serverless, its best use cases, and who should use it.

What is Serverless Architecture?

Despite its name, serverless architecture doesn't mean no servers are involved; instead, it abstracts away the complexity of server management from the developers, allowing them to focus solely on writing code to implement their application's functionality.

At its core, Serverless architecture is a cloud computing paradigm where developers build and run applications without managing the underlying infrastructure. In traditional application deployment, developers are responsible for provisioning, scaling, and maintaining servers to handle the application's workload. However, with Serverless, the cloud service provider takes care of all these tasks, making it an efficient and cost-effective approach for building scalable applications.

What are the real benefits of Serverless Architecture?

  • No Server Management: As the name implies, serverless architecture eliminates the need for server management. The service provider is responsible for all server-side operations.
  • Cost Efficiency: You only pay for the computing time you consume. There is no charge when your code is not running. This can result in significant cost savings compared to the traditional model of paying for server uptime.
  • Scalability: Serverless architecture can automatically scale your application in response to real-time demand. This is a significant advantage over traditional hosting, where you must configure autoscaling policies or overprovision your resources.
  • Faster Market Deployment: Serverless architecture can speed up software and feature releases. Developers can focus on the product instead of managing and operating servers or runtimes.
  • Built-in Availability and Fault Tolerance: Serverless providers automatically spread your application across multiple data centers in various regions to ensure high availability and protect against single points of failure.
  • Simplified Backend Code: Serverless architecture can simplify the backend code of applications, making them easier to write and maintain.
  • Focus on the Core Product: By offloading server management to the cloud provider, your team can focus on developing the core product rather than worrying about infrastructure issues.
  • Microservice Friendly: Serverless is inherently microservice-friendly, enabling developers to manage and update each function or microservice independently.
  • Yes, no more load balancers, clusters, autoscaling groups, server provisioning, memory issues, or the need for a dedicated DevOps team to maintain all this infrastructure.

    You might be wondering: If it’s so good, why isn’t it the go-to architecture for every company?

    This kind of architecture is not a one-size-fits-all solution, so you need to evaluate your use case and check if the conditions of Serverless architecture are a good fit for it.

    Who should use this architecture?

    If you have an already-working architecture on top of Kubernetes or a container orchestrator like ECS, you can simply migrate the whole system. Still, you can start by using some serverless microservices.

    But let’s focus on the most exciting case: You are starting a new project. Should you use Serverless? Let’s figure it out in the following diagram!

    A visual depiction of what is being written about

    You may run into a situation not covered in this diagram, but the main takeaway here is:

    If processing your requests is not CPU-intensive and doesn’t take too long, go with serverless!

    Let's see some practical examples with accurate pricing on top of AWS Lambda:

    Suppose that you are running a Python API with the following structure:

  • Basic Lambda config - 512MB of Memory
  • 100 million requests per month
  • Not CPU intensive, AVG Processing time ~100ms
  • How much would that cost?

    Less than $100 per month.

    Now, let’s think of another example, but this time, let’s put something in the middle:

    Suppose that you are running a Python API that serves a machine learning model (mid-size):

  • Basic Lambda config - 2048MB of Memory
  • 100 million requests per month
  • CPU intensive, AVG Processing time ~4s
  • How much would that cost?

    Approximately $ 13,000 per month.

    As you can see, it depends on your use case. But I can confidently say that a Kubernetes cluster handling 100 million requests per month serving the same machine learning model wouldn’t be cheap either, so even in this case, maybe Lambda would be the best way to go.

    Starting your own serverless project

    We are huge fans of Serverless at Taller. This architecture is compelling and makes it easier to face today's challenges. We have hundreds of microservices running on top of Serverless services like AWS Lambda, DynamoDB, SQS, and S3.

    The best part? It’s very straightforward to get started.

    I recommend using the Serverless framework and handling your infrastructure with it.

    Going back to the previously mentioned example of the Python API, you can define the whole infrastructure with a YAML file like this:

    service: fastapi-serverless-template
    frameworkVersion: '3'
    name: aws
    runtime: python3.9
    memorySize: 512 # optional, in MB, default is 1024
    timeout: 10 # optional, in seconds, default is 6
    versionFunctions: false # optional, default is true
    stage: ${opt:stage, 'dev'}
    region: ${opt:region, 'us-east-2'}
    handler: api/main.handler
    url: true
    - serverless-python-requirements
    - venv/**
    - node_modules/**

    If you want to start trying this right away, you can do it by following these steps:

    1) Install the Serverless framework with this command: npm install -g serverless

    2) Create a FastAPI serverless project using a starter template I created, just by using the command: serverless --template-url=

    And that’s it! you’re ready to deploy your first Serverless API!


    Serverless architecture is a game-changing approach that is reshaping the way we develop and deploy applications. By abstracting away server management, it allows businesses to focus more on their core products and less on operational concerns. The ability to only pay for what you use, combined with automatic scaling, can lead to significant cost savings and increased efficiency.

    Adopting a serverless architecture is not just about minimizing costs and maximizing efficiency. It's about enabling your organization to be more agile, scalable, and focused on what truly matters – delivering value to your customers.

    As we move forward into an increasingly digital future, this approach will continue to play a pivotal role in helping businesses stay competitive, innovative, and responsive to changing market demands. The journey to serverless may require a shift in mindset and practices, but its benefits make it a worthwhile investment.

    Article author picture
    By Agustin MarchiTechnical Lead at Taller
    Article uploaded on 07/19/23