Step by step guide on how port from AWS to Nimbella
By: Athithan Raj P
Tags: Lambda, AWS, Serverless, Nimbella, Openwhisk

In this article, we shall walk you through how Nimbella can fill up the space of AWS Lambda as an alternative and how you can port your functions to Nimbella.

AWS is the largest public cloud provider — but that doesn’t make it easy to use!

It can be challenging to work with because:

AWS is confusing for developers without deep experience in low-level cloud technologies. Businesses have to pay a hefty amount to get technical support from AWS. AWS Pricing is fiendishly complex and difficult to predict. Also, it doesn’t allow you to set a hard spending limit. Need a credit card to sign-up.

Giuseppe Miragliotta, Backend Software Engineer at Xtream

AWS Lambda’s pay-per-use pricing model is ideal for sporadic usages because you’re never paying for over-provisioned infrastructure. On the other end, costs can sum up rapidly on highly intensive workloads since these kinds of resources are expensive. Nimbella can help you save costs by using LaaS or CaaS services that are cheaper than FaaS, providing a proven and actively maintained architecture. Backed by Apache OpenWhisk, an open-source serverless solution, Nimbella comes with a high degree of portability. This means that the cost of moving to another cloud provider is greatly reduced and a multi-cloud strategy is also feasible, letting you choose the best products that suit your needs.

All these urge many users to look for the best AWS alternative which eventually gets them away from AWS Cloud lock-in.

Pros of Nimbella over AWS

The developers using the Nimbella platform only have to code the logic and Nimbella handles the rest including storage management, capacity provisioning, auto-scaling, monitoring, and logging.

Try Nimbella’s platform with a real example

Let’s create a new App and deploy it on Nimbella to get ourselves familiar with porting the functions from AWS-Lambda to Nimbella.

Please consider that we are going to create an invoice processing App with the below features.

Approve/Reject invoices Adding new invoices Exporting invoices

It will use React.js for the front-end and Node.js for the Back-end. For data storage, we can use Amazon’s dynamo DB in AWS-lambda and Nimbella’s Redis in Nimbella Platform.

Basic architecture on Nimbella:

Directory Structure on Nimbella:

Port your AWS Lambda functions to Nimbella

The following step-by-step guide will easily allow you to move your Lambda Functions to Nimbella.

1. Accounts creation and configuration

Nimbella: Create a new Nimbella Account and it gets activated without providing any card details.

2. Install & Set-up CLI

Let’s install CLI to deploy and interact with the cloud platform through the terminal.

Nimbella’s CLI can be installed by referring to this link for the respective Operating System.

To set up the CLI for Deployment and other activities we just need to log in to the CLI using the below command

nim auth login

3. Set-up Data Storage

Please consider that we are going to store our invoices as documents in the data storage.

Nimbella provides dedicated pre-integrated Redis key-value storage. We can directly use it as data storage without any configuration. We can do CRUD operation with our DB via CLI using the traditional Redis command as below.

nim kv set <keyName> <keyvalue>

4. Create Your API for Invoice Processor

Create a directory named “packages” which wraps the back-end code. Create a new directory that represents the app name inside packages. Create a new directory name that represents the API endpoint. Please note that in Nimbella each directory name represents API endpoints. Hence, create the directory how you want to name the API endpoints. Initiate a node js project with nim init -y Install nim-sdk package to access Nimbella’s Redis.

Once done, we can read our invoice data from Nimbella’s Redis with the below code.

Create a project.yml file and specify our directory structure (http end-points) of our function as below.

Our Serverless function can be deployed by running the below-given command in Nim-CLI.

nim project deploy <directory containing our proj>

Once deployed, we can get the API URL for the deployed function using the below command.

nim action get action <functionName>

Now, our API is ready to serve the requests seamlessly.

Deployed API URL (Nimbella):

https://boltnew2-doofwstmxcq-apigcp.nimbella.io/api/invoice/getdata

Front-End

Let’s create a React App by running the below command.

npx create-react-app <appName>

Once React App is created, we can implement the below features in the UI for the Invoice Processor in the usual React way as below.

Consume the API created in the previous step to render the invoices Approve/Reject Invoices Export Approved/Rejected/Pending invoices (using jsPdf) Add new invoices.

Our React App can be hosted on Nimbella by following simple steps:

Create a build.sh file and specify the commands to create a build from React App

2. Create a .include file and specify the file to be included for deployment

3. Configure project.yml for hosting our front-end as below.

Directory of our Invoice Processor having the React App (front-end) & Serverless function (Back-end) looks as below.

We can deploy our Invoice Processor App by running the below command.

nim project deploy <projectDirectory>

Once completed the host URL of Invoice Processor can be found in CLI as below.

https://boltnew2-doofwstmxcq-apigcp.nimbella.io/

GitHub Source: https://github.com/boltathi24/nimbella_redis_react_invoice_processor

In Brief: Porting Aws-lambda to Nimbella:

Wrap the AWS-Lambda’s functions inside the directory named “packages”. Wrap the front-end code inside the directory named “web”. Create a project.yml file and specify the configuration of the serverless function. Deploy it to Nimbella using Nimbella’s deploy command.

Benefits of Nimbella over AWS-lambda limitations

Nimbella provides a better developer experience by letting developers focus and invest time on App logic by removing architectural complexity. Nimbella supports multi-cloud deployment. Serverless Apps built on Nimbella can be deployed into your choice of cloud provider at any time. Nimbella provides integrated monitoring and logging to conveniently access logs and statistics from the terminal. Logging is more centralized and the output of the function won’t be feeling disjointed anymore since Logging can be accessed with Nimbella’s CLI instead of heading to CloudWatch in AWS. Our smart CLI builds the artifacts to be deployed dynamically from the project’s configuration file, unlike AWS Lambda where we zip the dependencies for deployment. Vendor lock-in is avoided with our multi-cloud deployment feature. Most of the popular programming languages are supported by the Nimbella Cloud (e.g., JavaScript, TypeScript, PHP, Python, Java, Go, or Swift, etc.) Nimbella lets developers feel themselves developing the end-to-end application by providing a way to deploy front-end (UI) and back-end (API) as a single deployment. Nimbella cloud platform is built on an open-source, Apache OpenWhisk. Hence it provides more data security and access control. No card details are required. Start with a generous free tier and grow with us. Nimbella offers dedicated secure domain, certificate management, CDN, and much more with ease. There is no development effort when you switch between cloud providers. The learning curve with Nimbella is very simple. You won’t be amused with the ’n’ number of services like AWS. Native support for state with in-memory high-performance data storage(Redis).

Conclusions

Nimbella is a modern developer-friendly Serverless platform that empowers you to build and run serverless applications in the simplest way. When you look out for alternatives to AWS Lambda, Nimbella suits perfectly and you can port your functions to Nimbella without much effort.

Please feel free to check out the latest Forrester Report on why Nimbella has been named as a Strong Performer among multiple players in the serverless space. Nimbella is a rising new generation serverless platform that could be considered as a great alternative to AWS and other cloud providers.

Author details: Athithan Raj P

Follow him on Twitter: @raj_athithan