AWS Serverless Microservices with Patterns and Best Practices

Video description

In this course, you will learn AWS event-driven serverless microservices using AWS Lambda, AWS DynamoDB, AWS API Gateway, AWS EventBridge, AWS SQS, AWS CDK for IaC, and AWS CloudWatch for monitoring. You will learn to develop reliable and scalable serverless applications, following the microservices architecture.

You will use AWS API Gateway for Restful API-driven development and synchronous event sources, AWS EventBridge for event-driven asynchronous communication between microservices, and AWS SQS for decoupling microservices and processing events asynchronously using queues. The project of building an e-commerce application will be totally serverless components. The serverless components that will be used are API Gateway, Product Lambda microservices, Basket Lambda microservices, and AWS EventBridge.

There will be three communication types: synchronous communication with AWS API Gateway, asynchronous communication with AWS serverless EventBus, which is EventBridge, and event source mapping communication when polling queue records from Lambda services to AWS SQS-Simple Queue Service. Finally, you will use AWS CDK for IaC Serverless Stacks developments that we will develop and provision for all services.

By the end of this course, you will learn how to design and develop AWS event-driven microservices using serverless patterns and best practices.

What You Will Learn

  • Create rules and target definitions for AWS EventBridge
  • Build REST API and CRUD endpoints using AWS Lambda, API Gateway
  • Work on data persistence using AWS DynamoDB
  • Decouple microservices with events using AWS EventBridge
  • Message queues for cross-service communication using AWS SQS
  • Work on cloud stack development with IaC using AWS CloudFormation CDK

Audience

This course is ideal for software developers who want to develop real-world projects with AWS serverless services and software/solutions architects who want to develop real-world projects with AWS serverless services. Students who would be appearing for the AWS Certified Developer Associate and AWS Certified Solutions Architect Associate will also be benefitted from this course.

You would need a basic knowledge of cloud, JavaScript, and TypeScript to get started with the course. Basic knowledge of using an AWS account is a plus but not mandatory.

About The Author

Mehmet Ozkaya: Mehmet Ozkaya is a software/solutions architect with over fifteen years of experience working with software companies around the world. He is now concentrating on cloud-native and serverless event-driven microservices architectures on AWS and .NET ecosystems.

He enjoys delivering online courses about designing software architecture for cloud-native and serverless event-driven microservices. He routinely contributes to GitHub and blogs on Medium.He enjoys delivering online courses about Designing Software Architecture for Cloud-Native and Serverless Event-driven Microservices. He routinely contirbutes to GitHub and blogs on Medium.

Table of contents

  1. Chapter 1 : Introduction to the Course
    1. Introduction
    2. Final Application – Serverless Event-Driven E-Commerce Application
    3. Project Code Structure
    4. AWS Cost Management During the Course
    5. Course Structure and Way of Learning
    6. AWS Lambda Invocation Types
    7. Our Serverless Journey with AWS Lambda Invocation Types
    8. Serverless Explained: AWS Operational Responsibility Model
    9. AWS Serverless Services for Microservices Architectures
  2. Chapter 2 : Project Code and Course Slides
    1. Project Code and Course Slides
  3. Chapter 3 : Create AWS Account – Free Tier
    1. Create Free Tier AWS Account
    2. Security Best Practices of AWS Accounts
    3. Create IAM User Account and Configure for Programmatic and Console Access
    4. AWS Access Types - Programmatic and Management Console Access
  4. Chapter 4 : Developing Our First Lambda Function
    1. AWS Lambda Overview
    2. How Does AWS Lambda Work?
    3. AWS Lambda Main Features
    4. AWS Lambda Event Sources and Destination Trigger Services
    5. AWS Lambda Invocation Types
    6. AWS Lambda Function Code
    7. AWS Lambda Walkthrough with AWS Management Console
    8. AWS Lambda Best Practices and Event-Driven Architecture
  5. Chapter 5 : Architecture Recap: Event-Driven Microservices Architectures
    1. Microservices Architecture
    2. Microservices Communications
    3. Event-Driven Microservices Architecture
    4. Application Integration Patterns for Microservices
  6. Chapter 6 : Thinking AWS Serverless for Event-Driven Microservices Architecture
    1. Thinking Serverless
    2. AWS as an Application Development Framework
    3. AWS Lambda as a Microservice
    4. Mapping Microservice Architecture with AWS Serverless Services for Microservice
    5. Event-Driven Serverless Microservices Design with AWS Lambda
    6. Serverless Architectural Patterns and Best Practices
  7. Chapter 7 : API Gateway RESTful API Development with Synchronous Lambda Event Sources
    1. Introduction to the Section
    2. What Is Amazon API Gateway?
    3. Architecture of API Gateway
    4. Main Features of API Gateway
    5. Amazon API Gateway Use Cases
    6. API Gateway as a Lambda Synchronous Event Sources
    7. Amazon API Gateway Core Concepts
    8. Amazon API Gateway - Differences Between REST - HTTP API
    9. Amazon API Gateway Walkthrough with AWS Management Console
  8. Chapter 8 : Building Microservices with AWS Lambda for Synchronous API-Driven Event Sources
    1. Developing AWS Lambda Synchronous Microservices with Amazon API Gateway
    2. Create a REST API from AWS Lambda Function by Adding API Gateway Trigger
    3. Understanding Lambda Trigger with Event JSON Object
    4. Understanding API Gateway Synchronous Trigger to AWS Lambda
    5. Resource Cleanup
  9. Chapter 9 : AWS DynamoDB Serverless NoSQL Data Persistence
    1. What Is Amazon DynamoDB?
    2. AWS DynamoDB Core Concepts - Tables, Items, Attributes, Indexes
    3. AWS DynamoDB Primary Key, Partition Key, and Sort Key
    4. AWS DynamoDB Walkthrough with AWS Management Console
  10. Chapter 10 : Building RESTful Microservices with AWS Lambda, API Gateway, and DynamoDB
    1. Introduction to the Section
    2. Create a DynamoDB Table
    3. Create a Lambda Function
    4. Create an API Gateway
    5. Test - RESTful Microservices with AWS Lambda, API Gateway, and DynamoDB
    6. AWS Console microservice-http-endpoint Lambda Blueprint - API Gw + Lambda + Dyna
    7. Resource Cleanup
  11. Chapter 11 : AWS Serverless Deployments IaC with AWS CDK (Cloud Development Kit)
    1. Introduction to the Section
    2. What Is IaC - Infrastructure as Code
    3. AWS Cloud Formation
    4. AWS CDK - Cloud Development Kit
    5. AWS CDK Core Concepts - Apps - Stacks - Constructs - Environments
    6. AWS Solutions Constructs with Levels L1 - L2 - L3 Pattern Construct
    7. AWS CDK Lifecycle
    8. CDK Serverless Patterns with Solution Constructs
    9. Serverless + CDK Automation + Integration Patterns = AWSome Microservices
    10. CDK - Hands-On IaC Development
  12. Chapter 12 : Prerequisites and Tools for Developing Serverless Applications on AWS
    1. Introduction - Prerequisites and Tools
    2. Prerequisites 1 - AWS Account and User
    3. Prerequisites 2 - AWS CLI
    4. Quick Setup of AWS CLI
    5. Prerequisites 3 - NodeJS
    6. Prerequisites 4 - AWS CDK Toolkit
    7. Check Your Installations
    8. Prerequisites 5 - Visual Studio Code
  13. Chapter 13 : Getting Started with AWS CDK by Developing Our First CSK Application
    1. Introduction to the Section
    2. Creating AWS CDK Application for IaC
    3. Building AWS CDK Application for IaC
    4. Explore CDK Project Directory
    5. Run CDK Commands on VS Code - Set-ExecutionPolicy RemoteSigned
    6. CDK Commands Overview
    7. Bootstrapping CDK Stack
    8. Developing Our AWS CDK App–Part 1
    9. Deploying Our AWS CDK App - Part 2
    10. Modifying Our AWS CDK App
    11. Deploying Our Modified AWS CDK App
    12. Don't Forget - Destroying Our AWS CDK App
    13. CDK Template Application Types
    14. CDK sample-app Template
  14. Chapter 14 : API Gateway-Lambda Synchronous RESTful Microservices with CDK
    1. Introduction to the Section
    2. Create a New Project for API Gateway-Lambda Synchronous Microservices with CDK
    3. Developing Lambda Handler Code
    4. Developing Infrastructure with CDK - Create Lambda Function and API Gateway – Part 1
    5. Testing Infrastructure with CDK
    6. Developing Infrastructure with CDK - Create Lambda Function and API Gateway – Part 2
    7. Testing Infrastructure with CDK
    8. Don't Forget - Destroying Our AWS CDK App
  15. Chapter 15 : Creating Our E-Commerce Serverless Microservices Project with CDK
    1. Introduction to the Section
    2. Create a New CDK Project for Our E-Commerce Serverless Microservices Project
  16. Chapter 16 : Understanding Our E-Commerce Domain
    1. Understand E-Commerce Domain - Use Cases - Functional Requirement
    2. Identifying and Decomposing Microservices for E-Commerce Domain
  17. Chapter 17 : Code Structure of E-Commerce Serverless Microservices Project in CDK
    1. Introduction to the Section
    2. Monorepo - What Is Monorepo and How Can We Use Monorepo?
    3. Code Structure for Our Application Architecture with CDK
    4. IaC Development with AWS CDK for Our Application Architecture
    5. Writing L3 Constructs and Construct Tree on AWS CDK
    6. AWS CDK (IaC) Versus AWS SDK (Microservices)
  18. Chapter 18 : Creating Product Microservices Serverless CRUD REST API Infrastructure with CDK
    1. Introduction to the Section
    2. Creating DynamoDB Database for Product Microservices with AWS CDK
    3. How to Know AWS CDK Construct Classes and Write Better IaC with AWS CDK
    4. Creating Lambda Function for Product Microservices with AWS CDK
    5. Implement Lambda Function Code for Product Microservices
    6. Creating API Gateway for Product Microservices with AWS CDK
    7. Deploy and Testing Serverless Product Microservices Sync Flow – Part 1
    8. Prerequisites 6 - Docker Desktop - Bundling Lambda Function with Libraries
    9. Deploying and Testing Serverless Product Microservices Sync Flow – Part 2
    10. Prerequisites 7 - Postman - Test and Manage API Gateway API Methods
    11. Testing Product Microservices Sync Flow; API Gateway - Lambda - DynamoDB
    12. Don't Forget - Destroying Our AWS CDK App
  19. Chapter 19 : Developing Product Lambda Microservices CRUD Functions with AWS SDK
    1. Introduction to the Section
    2. AWS CDK (IaC) Versus AWS SDK (Microservices)
    3. AWS SDK for JavaScript Version 3 and Lambda Interactions
    4. Start Developing Product Lambda Microservice - Install npm Package - @aws-sdk
    5. Developing Product Lambda Microservice with DynamoDB Client – AWS SDK for JS v3
    6. AWS API Gateway Trigger AWS Lambda with API Gateway Proxy Event (REST API)
    7. Developing Product Lambda Microservice with DynamoDB Client - AWS SDK for JS v3
    8. Understanding DynamoDB Interactions - Working with Items and Attributes
    9. Developing getProduct Methods for Product Lambda Microservice with DynamoDB
    10. Developing getAllProducts Methods for Product Lambda Microservice with DynamoDB
    11. Developing createProduct CRUD Methods for Product Lambda Microservice with Dyndb
    12. Using uuid Library When Creating Product Item in DynamoDB
    13. Developing deleteProduct CRUD Methods for Product Lambda Microservice with Dyndb
    14. Developing updateProduct CRUD Methods for Product Lambda Microservice with Dyndb
    15. Developing DynamoDB Query and Scan Operations for Product Lambda Microservice
    16. Developing Return Response of Product Lambda Microservice and Manage Switch Code
    17. Overview Product Lambda Microservice Developments
    18. Deploy and Test Serverless Product Microservices Sync Flow
    19. Create Postman Collection to Manage Product ApiGateway APIs
    20. Testing Product Microservices Sync Flow; API Gateway - Lambda - DynamoDB
    21. Environment Variable of Postman Collection - Best Practice Provisioned API URLs
    22. Don't Forget - Destroying Our AWS CDK App
  20. Chapter 20 : Organize Infrastructure Code with Creating Solution Constructs on AWS CDK
    1. Introduction - CDK Code Refactoring with Constructs -Creating Solution Construct
    2. Create Database Infrastructure Solution Construct for Our E-Commerce Serverless App
    3. Create Microservices Lambda Infrastructure Solution Construct for Our E-Commerce App
    4. Create API Gateway Infrastructure Solution Construct for Our E-Commerce Serverless App
    5. Deploying and Testing Serverless Product Microservices Sync Flow
    6. Don't Forget - Destroying Our AWS CDK App
  21. Chapter 21 : Creating Basket Microservices Infrastructure with AWS CDK – Add to Basket Case
    1. Introduction to the Section
    2. Analyzing Basket Microservices Use Cases for Our E-Commerce Serverless App
    3. Creating DynamoDB Database for Basket Microservices with AWS CDK
    4. Refactoring database.ts Infrastructure File
    5. Creating Lambda Function for Basket Microservices with AWS CDK
    6. Implement Lambda Function Code for Basket Microservices
    7. Creating API Gateway for Basket Microservices with AWS CDK
    8. Deploying and Testing Serverless Basket Microservices AddtoBasket Sync Flow
    9. Set Basket Microservices APIs in Postman Collection and Testing Basket Microserv
    10. Don't Forget - Destroying Our AWS CDK App
  22. Chapter 22 : Developing Basket Lambda Microservices Functions with AWS SDK
    1. Introduction to the Section
    2. Start to Developing Basket Lambda Microservice - Install npm Package - @aws-sdk
    3. Developing Basket Lambda Microservice with DynamoDB Client - AWS SDK for JS v3 – Part 1
    4. Developing Basket Lambda Microservice with DynamoDB Client - AWS SDK for JS v3 – Part 2
    5. Developing getBasket Methods for Basket Lambda Microservice with DynamoDB Client
    6. Developing getAllBaskets Methods for Basket Lambda Microservice with DynamoDB
    7. Developing createBasket Methods for Basket Lambda Microservice with DynamoDB
    8. Developing deleteBasket CRUD Method for Basket Lambda Microservice with DynamoDB
    9. Overview Basket Lambda Microservice Developments
    10. Deploy and Test Serverless Basket Microservices Sync Flow
    11. Testing Serverless Basket Microservices Add or Remove Basket Sync Flow
    12. Don't Forget - Destroying Our AWS CDK App
  23. Chapter 23 : AWS EventBridge for Decouple Microservices with Event-Driven Architecture
    1. Introduction to the Section
    2. Asynchronous Event Sources - Lambda Invocation Types
    3. What Is Amazon EventBridge?
    4. Benefits of Amazon EventBridge
    5. How Amazon EventBridge Works?
    6. Amazon EventBridge Core Concepts - Events - Event Buses - Rules - Targets
    7. Serverless Pattern: Fan-Out and Message Filtering with Publish/Subscribe Pattern
    8. Using AWS Lambda with Other Services - Amazon EventBridge
    9. Amazon EventBridge Walkthrough with AWS Management Console
  24. Chapter 24 : Creating AWS EventBridge EventBus Infrastructure with AWS CDK – Checkout Basket
    1. Introduction to the Section
    2. Analyzing AWS EventBridge and Checkout Basket Async Flow Use Cases for Decouple
    3. Creating AWS EventBridge for Decoupling Microservices with AWS CDK
    4. Creating Custom EventBus Construct for AWS EventBridge with AWS CDK
    5. Using Custom EventBus Construct in Main Stack with AWS CDK
  25. Chapter 25 : Creating Ordering Microservices Infrastructure with AWS CDK
    1. Introduction to the Section
    2. Analyzing Ordering Microservices Use Cases for Our E-Commerce Serverless App
    3. Creating DynamoDB Database for Ordering Microservices with AWS CDK
    4. Creating Lambda Function for Ordering Microservices with AWS CDK
    5. Implement Lambda Function Code for Ordering Microservices
    6. Creating API Gateway for Ordering Microservices with AWS CDK
    7. Fix Custom EventBus Target Function Parameter Error
    8. Deploying and Testing Serverless Ordering Microservices with AWS EventBridge Custom
    9. Test Custom Event Bus of AWS EventBridge Using Put-Event Method
    10. Set Ordering Microservices APIs in Postman Collection and Testing Ordering MS
    11. Don't Forget - Destroying Our AWS CDK App
  26. Chapter 26 : Develop Checkout Basket for Send Event to AWS EventBridge from Basket with SDK
    1. Introduction to the Section
    2. Start Developing Checkout Basket Function - Install npm Package - @aws-sdk
    3. Developing Checkout Basket Function with EventBridge Client - AWS SDK for JS v3
    4. Analyzing Checkout Basket Function in Basket Microservices
    5. Breakdown Methods to Checkout Basket Function with EventBridge Client - AWS SDK
    6. Developing "getBasket" of Checkout Basket Function with EventBridge Client
    7. Developing "prepareOrderPayload" of Checkout Basket Function with EventBridge
    8. Developing "publishCheckoutBasketEvent" of Checkout Basket Function with EventBrg
    9. Set Environment Variables for EventBridge Entry Parameters When Publish Checkout
    10. Developing "deleteBasket" of Checkout Basket Function with EventBridge Client
    11. Deploying and Testing Serverless Basket Microservices CheckoutBasket EventBridge
    12. Testing Serverless Basket Microservices CheckoutBasket EventBridge Async Flow
    13. Don't Forget - Destroying Our AWS CDK App
  27. Chapter 27 : Develop Ordering Microservice Consume Checkout Event from AWS EventBridge with SDK
    1. Introduction to the Section
    2. Start Developing Ordering Lambda Microservice - Install npm Package -@aws-sdk
    3. Developing Ordering Lambda Microservice with DynamoDB Client - AWS SDK for JS v3
    4. Catch and Process Async EventBridge Invocation and Sync API Gateway Invocation
    5. Developing Event Bridge Async Invocation of Ordering Lambda Microservice
  28. Chapter 28 : Developing Ordering Microservice Sync Invocation from API Gateway with AWS SDK
    1. Introduction to the Section
    2. Developing Ordering Lambda Microservice Sync Invocation from API Gateway
    3. Developing getOrder Methods for Ordering Lambda Microservice with DynamoDB Client
    4. Developing getAllOrders Methods for Ordering Lambda Microservice with DynamoDB
  29. Chapter 29 : E2E Testing Basket and Ordering Microservices Sync and Async Invocations
    1. Introduction to the Section
    2. Testing Serverless Basket Microservices CheckoutBasket EventBridge Async Flow
    3. Testing Ordering Microservices API Gateway Sync Flow
    4. Don't Forget - Destroying Our AWS CDK App
  30. Chapter 30 : AWS SQS for Event-Driven Architecture with Queues
    1. Introduction to the Section
    2. Polling Events and Event Source Mappings - Lambda Invocation Types
    3. What Is Amazon SQS?
    4. Benefits of Amazon SQS
    5. Amazon SQS Architecture and How SQS Works - The Lifecycle of an Amazon SQS Queue
    6. Amazon SQS Visibility Timeout
    7. Amazon SQS Short and Long Polling
    8. Amazon SQS Dead-Letter Queues
    9. Amazon SQS Queue Types - Standard Queues and FIFO Queues
    10. Serverless Pattern: Topic-Queue Chaining and Load Balancing Pattern
    11. Using AWS Lambda with Other Services - Amazon SQS
    12. AWS SQS Walkthrough Step-by-Step Tutorial over Console
  31. Chapter 31 : Creating AWS SQS Queue Infrastructure with AWS CDK – Polling Checkout Basket
    1. Introduction to the Section
    2. Analyzing AWS SQS and Polling Checkout Basket Event with Event Source Mappings
    3. Creating AWS SQS with AWS CDK
    4. Creating Custom Queue Construct for AWS SQS with AWS CDK
    5. Using Custom Queue Construct in Main Stack with AWS CDK
    6. Change Target Service of AWS Event Bridge Custom EventBus
  32. Chapter 32 : Developing AWS SQS Event Source Mapping Polling Invocation from Ordering with SDK
    1. Introduction to the Section
    2. How Lambda Function Event Source Mapping to AWS SQS for Polling Lambda Invocation
    3. Catch and Process SQS Polling Invocation in Ordering Lambda Microservice
    4. Developing SQS Event Source Mapping Polling Invocation of Ordering Lambda MS
  33. Chapter 33 : E2E Testing Basket and Ordering Microservices Event Source Mapping Polling
    1. E2E Testing Basket and Ordering Microservices Event Source Mapping Polling Invoc
    2. Testing Serverless Basket Microservices CheckoutBasket EventBridge Async Flow
    3. Testing Ordering Microservices API Gateway Sync Flow
    4. Don't Forget - Destroying Our AWS CDK App
  34. Chapter 34 : What Next – AWS Step Functions for Orchestration Order Fulfilment
    1. AWS Step Functions for Orchestration Order Fulfilment with Saga Pattern
  35. Chapter 35 : Thanks
    1. Thanks and Conclusion

Product information

  • Title: AWS Serverless Microservices with Patterns and Best Practices
  • Author(s): Mehmet Ozkaya
  • Release date: November 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781804611203