Intive Blog

How to Design a Serverless Infrastructure in 10 Steps

We have already discussed serverless architecture in this article. Now we will see how to set it up.

First, we need:

  1. 2½ cups flour
  2. 1½ cups granulated sugar
  3. 1 cup cocoa powder
  4. 2 teaspoons baking powder
  5. ½ teaspoon baking soda
  6. ½ teaspoon fine salt
  7. 1 cup vegetable oil
  8. 1 cup cold milk

That is a recipe for a delicious chocolate cake, to enjoy ideally with coffee, tea or “mate”, as a way to get ready to define our architecture.

1. Define your Functionalities

If it’s your first time, I would suggest you start by simple functionalities you know you can delegate and implement. This will help you understand how the serverless world works. Think of specific functionalities such as uploading an image, saving a record, processing data.

Bear in mind that a functionality can be used by another one, or that it can include a problematic sub-functionality from which it can be detached. In some cases, that is difficult to detect, so you will have to analyze whether it’s convenient to detach it or not.

2. Think in Sequences

Once you understand the functionality, think of it as a sequence where each event triggers the next one. Each functionality has to be precise. It’s useful to make a diagram of the functionality in order to visualize what could be the flow of events. If you are unable to do that, check the sequence again and try to simplify it.

Each event should be able to modify or move information to the next one, something that can be represented as a chain of events. Every element in the sequence must be independent from the others, so in case you have to modify one, you don’t affect the whole process.

3. Know your Cloud

Identify which cloud services are best for you. Many bring benefits, but can also be pricy. That is why it’s important to understand the payment models and capabilities that each one has to offer. Consider doing concept tests in order to determine how to configure a service in the easiest way possible.

4. Try to Delegate Responsibilities

Consider the services that can be useful for your proposal, and what is the expertise required. Bear in mind that you are not compelled to use all the services available out there, nor to use a virtual machine. Baby Jesus won’t cry if you decide to implement a hybrid architecture (Santa may, but he’s away in the North Pole and doesn’t bring us presents any more), however, consider choosing a cloud service instead of a service you will have to manage all by yourself.

5. Know your Control Points

Every event modifies or moves information. You can monitor your control points. If an event is not running as expected, you should be able to recover it and bring it back to its normal flow. Consider how you can bring the process back to normal from a control point in your sequence, whether by going back to the previous element or, in the worst case, by starting over.

6. Consider Adopting a Permission Scheme

The service to be used should not be exposed to external elements. Otherwise, that would represent a security breach in our architecture. Consider what are the minimum permissions required for an event to trigger the next one. This may be tedious and complex but, at the same time, gives us confidence in our architecture.

7. Go by parts, first

When implementing, test the sequence starting by each one of the events. It’s like a service integration test. Once all elements are connected, you should be able to check for security and recovery ability.

8. Relax

Just relax. Remember to record everything and search feedback from other team members.

9. Repeat Until You are Satisfied

Try to keep things simple. Go over this list’s previous steps until you feel confident about the flow of events.

10. Search an Optimal Configuration Based on Tests

Every service has specific configurations for different scenarios. They also vary in price, which can impact a functionality’s total cost. One of the aims of implementing a serverless architecture is to keep costs to the minimum, but a configuration that has gone wrong can impact the final bill.

When designing any architecture, the hardest part is how to set it up. Maintaining a mature architecture always requires interaction and feedback.

Rodolfo Cordero

Rodolfo Cordero has been a developer at intive since June 2016. He is a graduate in Software Development from the Universidad Latina de Costa Rica, his country of origin. A regular reader and music lover, he took courses in cocktailing and to become a barista, skills that delight the staff of intive in the after parties organized by the company.

Add comment