Move a Simple JavaScript Node.js AWS Lambda Function to Azure

Jeremy Likness ⚡️ - Sep 11 '19 - - Dev Community

This article is part of #ServerlessSeptember. You'll find other helpful articles, detailed tutorials, and videos in this all-things-Serverless content collection. New articles are published every day — that's right, every day — from community members and cloud advocates in the month of September.

Find out more about how Microsoft Azure enables your Serverless functions at https://docs.microsoft.com/azure/azure-functions/.

“It’s time to migrate.”

Maybe the decision to switch cloud providers came “down from above.” Maybe the decision was yours. Perhaps your original solution was merely a spike to “kick the tires” of one cloud, and now it’s time to try another. Looking into a multi-cloud "hybrid" solution? Whatever your reasons, if you are considering moving your serverless code from AWS Lambda to Azure Functions, you’re in the right place to learn how!

Lambda to Azure Functions

Moving from Lambda to Azure Functions” is a six-part videos series that covers what you need to know to make the transition between cloud providers. You’ll learn how to migrate your app, explore how resources in Azure relate to Amazon AWS, build a function locally, deploy it manually and learn how to push it automatically as part of a CI/CD pipeline.

The Sample App

The sample app is simple but does more than just echo text or print, “Hello, world.” It computes whether or not a number is a prime and uses a cache to store the results to serve them quickly on subsequent calls. The AWS Lambda implementation uses JavaScript (Node.js) and Amazon DynamoDB.

The sample function

You can view the source code for the sample app and deploy the migrated code directly to Azure with a single-click in the “AWSMigration” GitHub repository.

GitHub logo JeremyLikness / AWSMigration

Migrate from AWS Lambda to Azure Functions

Move AWS Lambda to Azure Functions

This is the source code for the "Moving from Lambda to Azure Functions" video series that demonstrates how to migrate from AWS Lambda to Azure Functions.

🎦 Watch the video series (YouTube playlist)

Quick Start

Free Azure Account Get your Free Azure Account

You can get started quickly with the migrated function. Simply click or tap the "Deploy to Azure" button. Be sure to enter a unique prefix (for example, use your initials or add a sequence). After the deployment is done, you can access and test the function.

Deploy to Azure

To enable the cache, navigate to the storage account after it is created. Click on Tables under Table service then add a table named primes.

The Code

This repository contains code for all related projects.

Source ("Pure") Function

The function itself determines whether a number passed is prime or not. The pure function is available in src\isItAPrime.js

The first video provides and overview of the sample application and shows how to test and access it from the portal and the command line.

In the next article, we'll explore how to create an Azure Function from scratch.

If you're familiar with AWS but new to Azure, check out this AWS to Azure Services comparison.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .