Engineering

Beginners Guide to Serverless Apps

Avatar

Tatiana B.

·
Blogs banner

As heard from our US-based clients, serverless seems to be the hype word for applications right now. Every cloud platform, from AWS to Azure to IBM, is listing serverless services and spreading its pros everywhere.

However, before we get into serverless applications, we need to understand: What is being serverless about? Are we truly going around without servers at all?

The serverless computing model offers to focus on the business side instead of the infrastructure. The majority of platforms offer serverless architectures that are cheap and easy to maintain. Serverless architectures are often based on Functions as a Service (FaaS), deploying only a piece of business logic in the form of a function. Some examples of these functions are AWS Lambda or Google Cloud Functions. Implementing the serverless model is very attractive because it means less time getting lost on the implementation of complex architecture. But there’s more to this than meets the eye.

First of all, serverless does not mean getting rid of servers. It just means that the cloud vendor will manage the allocation and provisioning of servers in a dynamic way, so your application can run on stateless computers triggered by an event. Every time a function is called, the cloud vendor manages to assign a compute container for that specific execution. By doing this, the vendor prices the services based on the number of executions rather than computing capacity.

Until now, going serverless should seem easy as a piece of cake, but not everything about the infrastructure should be left to the cloud vendor.

5 tips for building a serverless application smoothly:

####1. Be aware of the use case:**

With the advent of serverless, long gone are those days where we had to spend a lot of time and resources every time we wanted to launch to production. On serverless, we don’t have to worry about load balancing and orchestration anymore because it is outsourced now. However, the serverless computing model doesn’t work for every use case. For example, taking into account that on AWS Lambda every function should get executed on a window of a maximum of 15 minutes, we know beforehand that long-running jobs won’t work in serverless.

Also, if you can’t predict how many resources like disk space and memory your application is going to use, serverless services won’t be the best approach since they have limitations on that per their nature.

####2. Use IaaC as much as possible**

In the serverless computing model, there is no server administration as we know it, but it doesn’t mean that it is completely no-ops. There is indeed a need to set up and deploy a serverless function, allocate resources, time out, environment variables, etc. Doing that is kind of tedious, and more for developers not used to managing infrastructure. Don’t worry, though; Infrastructure as Code (IaaC) is the solution for that.

Terraform, Ansible, Cloudformation, and others are around to help you convert infrastructure issues into code that you can copy, paste, test, and even share. Defining every one of them would be a matter for another post, but you can always rely on their wonderful documentation. Last but not least, there are also agnostic frameworks to deploy serverless code on several cloud platforms, like Serverless (JavaScript, Python, Golang), Apex, and Up.

####3. Keep your bundle as small as possible**

Even though serverless cloud platforms support a lot of languages and frameworks, we should keep in mind that anything resource-hungry doesn’t work on serverless. For that reason, the advice is to keep everything as small as possible, since serverless applications are meant to be lightweight.

For the use of dependencies, it depends on the language and its version whether it’s a challenge or not to implement them. In the case of JavaScript and NodeJS, they bring a lot of native dependencies, making this easier, but that’s not the case for C, for example.

Just remember that serverless functions are limited on disk space and memory; because of that, the fewer dependencies a function has, the better performance it has on this model.

####4. Keep in mind that serverless functions don’t have IPs**

Since serverless functions are servers allocated dynamically, they don’t have IPs. That’s important to remember whenever you are accessing third-party APIs through VPNs. If you need to access a private endpoint and the only authorization possible is through whitelisted IPs, there are ways to work around this on serverless applications.

At least on AWS Lambda, you can put the functions inside a security group inside a VPN, which is connected to an Elastic IP, in order for them to have a static IP.

####5. Don’t forget, Serverless also means stateless**

Last but not least, you cannot forget that serverless functions are stateless, even though they might store a certain cache. Two executions of the same function can run on two different computing containers; for that reason, you can’t just store data on disk space. If storing data becomes necessary, you can always rely on external services such as databases or file storage services, such as S3 and DynamoDB on AWS.  We have seen a shift to serverless apps by a number of our US-based clients, ranging from Qrvey and scoreapp.com to name a couple.

Why Ideaware?

Since 2010, we’ve helped US companies scale with top-tier tech talent, not just by filling roles, but by becoming long-term partners in growth.

  • We handle sourcing, hiring, onboarding, and retention.
  • Start receiving CVs as soon as 48 hours.
  • You could meet your new teammate in as little as 8–12 days.
  • Our retention rates are 2x the industry average.

Contact us here to discuss your hiring strategy, and we will get in touch with you within 24 hours or less.

Team overview

Join +8k Founders

Join the Founders' Toolkit

Subscribe for exclusive content to help you scale your tech team 🖖🏼

More articles