Thinking AWS Serverless for Event-Driven Microservices Architecture

In this article, we are going to learn about How to Think AWS Serverless for Event-Driven Microservices Architecture when developing Serverless E-Commerce application.

Serverless Event-driven E-commerce Microservices Architecture

At the end of the article we will be following the Reference Architecture above which is a Real-world Serverless E-commerce application.

Step by Step Design AWS Architectures w/ Course

I have just published a new course — AWS Serverless Microservices with Patterns & Best Practices.

In this course, we’re going to learn how to Design and Develop AWS Serverless Event-driven Microservices with using AWS Lambda, AWS DynamoDB, AWS API Gateway, AWS EventBridge, AWS SQS, AWS CDK for IaCInfrastructure as Code tool and AWS CloudWatch for monitoring.

Source Code

Get the Source Code from Serverless Microservices GitHub — Clone or fork this repository, if you like don’t forget the star. If you find or ask anything you can directly open issue on repository.

What is Serverless ?

Basically serverless is Build and run applications without thinking about servers. That means running code, managing data, and integrating applications, all without managing servers.

Serverless technologies feature automatic scaling, built-in high availability, and a pay-for-use billing model to increase agility and optimize costs. These technologies also eliminate infrastructure management tasks like capacity provisioning and patching, so you can focus on writing code that serves your customers.

Serverless applications start with AWS Lambda, an event-driven compute service natively integrated with over 200 AWS services and software as a service (SaaS) applications.

When we say Serverless, its the removal of server operations and this is important distinction for customers because it allows you all to focus on the building application rather than managing and scaling of infrastructure that's needed to support the application.

There are 4 main pillar when we defining serverless as an operational model.

No Infrasturcture provisioning and No management

There is no servers to spin up operate or patches. There is no physical or virtual container orchestration. Serverless applications are automatically scale by unit of consumption rather that by server unit. This is important for companies, because you can pay-as-you-go model only consumption charge without considering any scalability issues.

Pay for Value

So Serverless has pay for value billing model which means you only pay what you use not for idle time. So you can easily run your ideas to production without expensive infrastructure building. That means you can experiment more. Also we can execute the idea of new features with a-b test on Serverless infrastructure without charging any extra cost. Only pay for what your customer is using.

Built-in Availability and Scalability

Serverless applications are built-in availability and fault tolerance. There is no need extra architecture for high availability and high scalability designs, these features comes from the beginning.

This is important because exceptions can happen anytime, so reliable and resilience architecture are crucial when you running business so Serverless provide this from the beginning. Think to design multi-cluster applications from scratch, it will really costly and unpredictable results. So Serverless handle all automatically.

Built-in Security

Also implementing security is built-in Serverless is very efficient with using AWS Cognito and IAM. With Serverless you can precisely define how different services and resources can interact.
AWS IAM gives granular policy based security that in well-architected solution in your application that strong security aspects.

Benefits of Serverless

We can say several main benefits of Serverless.

Move from idea to market, faster

Eliminate operational overhead so your teams can release quickly, get feedback, and iterate to get to market faster.

Lower your costs

With a pay-for-value billing model, resource utilization is automatically optimized and you never pay for over-provisioning.

Adapt at scale

With technologies that automatically scale from zero to peak demands, you can adapt to customer needs faster than ever.

Build better applications, easier

Serverless applications have built-in service integrations, so you can focus on building your application instead of configuring it.

Thinking Serverless

Thinking Serverless has some main pillars;

Features First

Breaking down the application to simple components that allows to think small with serverless. We can follow “decompose by business capacity” principle.

Focus on Events

Events is the key of serverless applications. A serverless solution is entirely event-driven.

Stateless

This is key to on-demand scaling, so with event-driven architectures, events are immutable objects publish and subscribe from stateless services.

Data Flow

AWS provides really good amount of different data services that you can handle your data problems in serverless design.

Use the services

AWS has broad range of different tools that you can use when designing your systems.

What are Serverless Services ?

You can see in the image below, that includes different services by grouping with functionality.

https://d1.awsstatic.com/events/reinvent/2019/REPEAT_3_Serverless_architectural_patterns_and_best_practices_ARC307-R3.pdf

Serverless is not means only AWS Lambda. Lambda is only the service is solution for computing requirements.

For example;

  • API Gateway to provide interface into your application
  • DynamoDB for low latency web scale NoSQL database for application data
  • S3 for durable long-term object storage for user data
  • Step Functions for complex workflows to orchestrate operations in your applications
  • EventBridge, SNS, SQS these are managing data with integration of services across your applications
  • Kinesis for real-time streaming data

As you can see that, we have understood that what is serverless is and how we can think serverless.

AWS Serverless Microservices for Ecommerce Application Architecture

Here you can find the main overall Serverless Architecture for our application. This is the big picture of what we are going to develop together for AWS Serverless Event-driven E-commerce Microservices application that is Step by Step Implementation together.

Serverless Event-driven E-commerce Microservices Architecture

We will be following the reference architecture above which is a real-world Serverless E-commerce application and it includes;

  • REST API and CRUD endpoints with using AWS Lambda, API Gateway
  • Data persistence with using AWS DynamoDB
  • Decouple microservices with events using AWS EventBridge
  • Message Queues for cross-service communication using AWS SQS
  • Cloud stack development with IaC using AWS CloudFormation CDK

Step by Step Design AWS Architectures w/ Course

I have just published a new course — AWS Serverless Microservices with Patterns & Best Practices.

In this course, we’re going to learn how to Design and Develop AWS Serverless Event-driven Microservices with using AWS Lambda, AWS DynamoDB, AWS API Gateway, AWS EventBridge, AWS SQS, AWS CDK for IaCInfrastructure as Code tool and AWS CloudWatch for monitoring.

Source Code

Get the Source Code from Serverless Microservices GitHub — Clone or fork this repository, if you like don’t forget the star. If you find or ask anything you can directly open issue on repository.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mehmet Ozkaya

Mehmet Ozkaya

Software/Solutions Architect, Udemy Instructor, Working on Cloud-Native and Serverless Event-driven Microservices Architectures https://github.com/mehmetozkaya