Back

Cost Efficiencies with Azure and Serverless

Nitric Logo
Rak SivRak Siv

Rak Siv

8 min read

While the benefits of adopting serverless may be clear to a startup or small business, adoption can feel daunting due to the unknowns around costs – how much will it cost to run a serverless application? What other hidden costs will we run into? There are some key ways these businesses can strategize and take advantage of serverless benefits to be as cost-efficient as possible.

Azure Cost Efficiency

Azure's pricing models, commonly discussed in relation to large corporations and their detailed agreements with Microsoft, can appear complex and less relevant to smaller organizations. This perception often obscures the experience of startups and small to medium-sized enterprises (SMEs), who require straightforward and predictable pricing when using Azure's cloud services.

This is where the concept of serverless computing, combined with the pay-as-you-go approach, becomes especially appealing for those smaller organizations, offering a cost-effective and scalable solution for their cloud computing needs.

The Azure Pay As You Go (PAYG) cost model is a flexible pricing scheme by Microsoft for its cloud services, involving no upfront costs. Users are billed based on their actual usage of resources like virtual machines, storage, and bandwidth. PAYG pricing models align perfectly with the on-demand, event-driven nature of serverless architectures. This model supports automatic scaling, matching costs with actual usage, and eliminates the overhead of server management.

Calculating Azure costs

Azure provides cost calculators that are powerful tools for estimating cloud service expenses, but their effectiveness depends on having a clear understanding of the specific resources you plan to use. Using serverless resources like Azure API Gateway and Azure Functions simplifies cost estimation in Azure. These services focus on execution counts and durations, which makes it easier to predict costs compared to configuring detailed infrastructure resources.

Here's a hypothetical example so you can clearly understand costs for a pretty common setup using the features you'd likely need:

Let’s say we’ve built an API called EasyFinance to help small businesses and independent entrepreneurs efficiently manage their finances. The EasyFinance API provides small businesses essential financial functionalities such as checking account balances, viewing transaction histories, and facilitating straightforward payment processing.

Built on Azure's serverless architecture, it leverages Azure Functions for computation, Azure API Management for handling requests, and Azure Blob Storage for data storage. This setup ensures a cost-effective, scalable, and reliable financial management tool tailored for small-scale business needs.

Using these services as our starting point, let’s estimate our monthly computer costs, which are summarized in this table and come to a total of roughly $3 per month for a million executions and 250,000 reads/writes on a 10GB blob storage account.

Service CategoryFunction in EasyFinance APIDetailed DescriptionMonthly Cost
Azure FunctionsComputational tasksThe first 400,000 GBs of execution and 1,000,000 executions are free.$0.00
API ManagementUser access and request managementFirst 1,000,000 calls free per month per Azure subscription.$0.00
Storage Accounts (Azure Blob Storage)Data storage for transactionsStandard Blog storage, Locally redundant storage, Hot Access Tier, 10GB Storage with 250,000 reads and 250,000 writes$2.97
Total Estimated$2.97
  • All costs listed are for estimation purposes only and are based on pricing information at the time of writing. Using additional tools or hosting a static site will increase costs and utilize additional Azure features or 3rd party services e.g. Vercel.

For a startup or SME utilizing a serverless architecture like Azure Functions and Azure API Management, the expenses largely depend on the number of API calls made. This makes it a budget-friendly option for managing cloud expenses throughout the year. Basically, your usage costs will be proportional to the success of your API and business objectives.

We’ve taken advantage of Azure’s always free offerings, e.g. 1 million free Azure Function executions. Note that the estimated cost will likely change if there are greater demands on the API - however, that means that EasyFinance is getting usage; as long as it is providing business value, any increase in cost is a positive outcome.

Here is a screenshot of the numbers used for Azure function, create a customized estimate here.

Azure cost estimate

Source: Azure

Beyond Hosting Costs: Development and Operational Efficiency

Focusing only on direct cloud resource costs gives an incomplete financial view for startups and SMEs. Much of their development costs are hidden, like the time and effort of teams in setting up environments and pipelines. These tasks, while essential, can be resource-intensive. Azure offers a solid platform, but its cost-effectiveness depends on efficient development processes. Two Ways to Reduce Serverless Setup and Deployment Overhead

Developers often spend a substantial amount of time configuring runtime environments and deployment pipelines. This includes dealing with intricacies of infrastructure management, ensuring environments are consistent, and setting up automated deployment processes. Each of these tasks, while vital, can divert attention away from core development work, leading to increased project timelines and costs.

Streamline with GitOps: GitOps emerges as a powerful solution to these challenges. By using Git as the backbone for operational workflows, GitOps introduces a high level of automation and consistency in managing infrastructure and deployments. This approach reduces manual setup and maintenance efforts, allowing developers to concentrate on writing code and delivering features. The automation and repeatability brought by GitOps not only save time but also reduce the risk of errors associated with manual interventions.

Github actions pipeline

Enhance with Nitric: Alongside GitOps, frameworks like Nitric can further streamline development. Nitric abstracts away many of the complexities associated with cloud services, enabling developers to focus more on business logic rather than on the nuances of cloud environments. This can significantly speed up the development process, reduce errors, and, consequently, lower the costs associated with lengthy development cycles.

Recap

Serverless solutions are perfect for organizations seeking to unburden themselves from the total cost of ownership of servers. For organizations looking to leverage Azure's capabilities effectively, it is imperative to recognize the importance of efficient development practices. By reducing the overheads associated with runtime environment setup and deployment pipelines, and by embracing streamlined approaches like GitOps, businesses can significantly cut down on development costs, leading to more cost-effective, and successful cloud projects.

Check out what we’re building in the open source Nitric framework and support us with a star on GitHub!

Previous Post
Achieve GitOps on Day One with IaC Automation
Next Post
How Nitric V1 Changes Cloud Development