Microservices Lambda Best Practice with CI/CD, without Framework

Production Guide to lambda
Feb 16, 2024
Microservices Lambda Best Practice with CI/CD, without Framework

Introduction

Thank you for clicking through to my practice. I've been a DevOps Engineer for 2 years in dev-team of 7 engineers.

My name is MINSEOK, LEE, but I used Unchaptered as an alias on the internet. So, you can call me both"MINSEOK, LEE" and "Unchaptered" to ask something.

When to use AWS Lambda.

AWS Lambda provides extensive integration with other resources. When you used properly, Lambda can help developers simplify their workloads.

Of course, it's true that Lambda is more expensive than EC2 if it's on for the same amount of time and same spec.

However, if any of the following apply to you, Lambda might be a better choice than you think.

  1. Have small budget to use minimum server fee.

  2. Difficult to operate complex CI/CD workloads on EC2, ECS and EKS.

What is the barriers for Lambda Adoption?

Lambda is convenient as a fully-managed service. But it has a few Big Barriers to use. There are many articles and architectures that looks like "Lambda or Serverless is Silver Bullets". However, it's hard to actually build a work process to work on multiple Lambda.

What is today's topic?

In this practice, you can understand it with Monolithic Lambda Best Practice for these situations.

  • Use Lambda with S3 Event Notification

  • Use Lambda with API Gateway

  • Use Lambda with Scheduler


Prerequisites

Understanding from a architecture perspective

This practice is "Monolithic Lambda Best Practice" based on AWS Resources.
It is built around a few architecture, so some basic knowledge is require of architecture.

Will be mentioned in this article, the following architectural terms includes:

  • Monolithic Repository Pattern

  • Microservice Architecture

  • Serverless Architecture

Monolithic Repository Pattern

Often, a single repository will contains a single server. It means a single repository for an API server contains a single API Server. Generally, we called it "Multi Repository Pattern".

Even though this pattern is very productive and useful, it's not suitable Lambda. If you used this pattern with Lambda, you need to create each repository for each lambda.

Therefore, we use "Monolith Repository Pattern".
Using this pattern, a single repository contains all lambda functions.

Microservices Architecture

Microservices are an approach used in software development architecture. It separate one service to micro services into smaller.

Each microservice performs a specific function or task. And they communicate with each other through a RESTful API or messaing system.

This approach increase flexibility and scalability and reduce complexity by reducing the coupling between services.

The opposite concept is Monolithic Architecture, which makes the entire service a single server.

Serverless Architecture

When you deploying server, developer typically use compute resource, such as EC2, ECS or EKS. These services are little different, but it require additional configuration for availability, scalability and more.

However, serverless literally means that the function works without a server(EC2, ECS or EKS), which require various setting.

Services, created under a serverless architecture, are often seen as fully-managed services that automatically scale, restore, and more actions.

Design of Structure

Understanding from a code-level perspective

Share article
RSSPowered by inblog