top of page

Are you serverless?


Serverless computing refers to a model of cloud computing where the cloud provider is responsible for managing and scaling the infrastructure required to run the code. This means that developers do not need to worry about server management, and can simply focus on writing and deploying their code.

Serverless functions, also known as Function-as-a-Service (FaaS), are a type of serverless computing that allows developers to run small pieces of code in response to events, such as HTTP requests or messages from a queue. These functions can be written in a variety of programming languages and are typically executed within a few milliseconds of being triggered.

Serverless functions are useful when you need to run code in response to an event, but don't want to pay for a full server to be running all the time. They are typically used for tasks such as running backend API endpoints, processing data streams, or responding to webhooks.

When deciding whether to use serverless functions, it's important to consider factors such as expected traffic levels, the complexity of the code, and the cost of running a traditional server. Serverless functions can be a cost-effective and scalable solution for many use cases, but they may not be suitable for all workloads.


The three major cloud providers, Azure, Google Cloud Platform (GCP), and Amazon Web Services (AWS), offer their own serverless compute services. Here's an overview of how to use serverless functions on each of these cloud platforms:

Azure Functions:

Azure Functions is Microsoft Azure's serverless computing offering. Here's how to use it:

  1. Create a Function App: Start by creating a Function App in the Azure portal. This app provides the environment for your functions.

  2. Develop Your Function: Choose your preferred programming language (e.g., C#, JavaScript, Python) and write the function code. You can use the built-in code editor, integrate with Visual Studio, or use VS Code.

  3. Trigger and Bindings: Define the triggers that initiate the function (e.g., HTTP request, timer, storage change) and bindings to data sources like Azure Storage, Cosmos DB, or SQL Database.

  4. Testing: Test your function locally using Azure Functions Core Tools or the Azure portal.

  5. Deploy: Publish your function to the Azure Function App. You can also set up continuous integration for automatic deployments.

  6. Scaling: Azure Functions automatically scales your functions based on demand. You only pay for the resources used during execution.

Google Cloud Functions:

Google Cloud Functions is GCP's serverless compute offering. Here's how to use it:

  1. Enable the Cloud Functions API: In the GCP Console, enable the Cloud Functions API for your project.

  2. Write Your Function: Create your function using Node.js, Python, Go, or other supported languages.

  3. Specify Trigger: Choose a trigger event for your function, such as HTTP request, Pub/Sub message, or Cloud Storage event.

  4. Deploy: Deploy your function by uploading the code and specifying the trigger event. Google Cloud Functions automatically handles scaling and resource management.

  5. Testing: Test your function using the GCP Console or the command-line tool.

  6. Monitoring: Monitor function execution and errors using Google Cloud's logging and monitoring tools.

AWS Lambda:

AWS Lambda is Amazon Web Services' serverless compute service. Here's how to use it:

  1. Create a Lambda Function: In the AWS Management Console, create a new Lambda function.

  2. Write Your Function: Choose a runtime (e.g., Node.js, Python, Java) and write your function code.

  3. Set Triggers: Specify the event source that triggers your function, such as an S3 bucket change, an API Gateway request, or an Alexa skill.

  4. Configure Function: Define function settings, including memory allocation, timeouts, and IAM roles for accessing other AWS services.

  5. Testing: Test your function using the AWS Lambda Console or command-line tools.

  6. Deployment: Deploy your function, and AWS Lambda automatically manages scaling and resource allocation. You're billed based on execution time and resource usage.

  7. Monitoring and Logging: Use AWS CloudWatch to monitor function performance, errors, and logs.

Each of these cloud providers offers serverless functions with their unique features and integrations. The choice of platform depends on your specific needs, existing cloud environment, and familiarity with the respective services. All three provide robust serverless solutions for a wide range of use cases.


Serverless functions can lead to significant cost savings, especially when compared to traditional server-based computing models. Here's an example of how serverless functions can result in cost savings:

Scenario: Imagine a small e-commerce company that needs to process and resize product images uploaded by users. The company expects variable traffic with occasional spikes, such as during holiday sales.

Traditional Server-Based Approach:

  • In a traditional server-based approach, the company would need to provision and maintain a set of virtual machines to handle image processing.

  • These virtual machines would have to be sized to accommodate peak loads, which results in over-provisioning during non-peak times.

  • The company would need to manage the server infrastructure, including OS updates, security patches, and scaling during traffic spikes.

  • Costs include server hardware, software licenses, ongoing maintenance, and the expense of over-provisioned resources.

Serverless Approach (Using AWS Lambda as an Example):

  • With a serverless approach, the company can create an AWS Lambda function to process and resize images.

  • The function is triggered by an event, such as an image upload to an S3 bucket.

  • AWS Lambda automatically scales the function to handle incoming events and processes them in parallel.

  • The company only pays for the actual compute time used, measured in milliseconds, rather than for the constant operation of servers.

  • During periods of inactivity, no resources are consumed, resulting in cost savings.

Cost Savings:

  • The company can potentially save a substantial amount in infrastructure costs, as they no longer need to maintain a fleet of servers.

  • Costs are directly tied to usage, so the company pays only for the compute time needed to process image uploads.

  • During low-traffic periods, the cost approaches zero, ensuring efficient resource utilization.

  • The company can redirect resources and budget to other business areas, such as improving the user experience or expanding their product offerings.

Serverless functions offer cost savings through efficient resource utilization, automatic scaling, and a pay-as-you-go pricing model. This example illustrates how serverless can be a cost-effective solution for workloads with variable and unpredictable demands, such as image processing, data transformations, and event-driven tasks.


Sash Barige

Jul/24/2019


Photo Credit: Unsplash.com

Recent Posts

See All

Kommentare


bottom of page