Best Way to Learn AWS Services

In this article, we are going to talk about Best Way to Learn AWS Services when developing Serverless E-Commerce application.

Best Way to Learn AWS Services

If you followed the other articles, you can see that, we deployed full Serverless E-commerce application services on AWS Serverless cloud environment.
And we have followed 2 main parts when developing our application;

  • Exploring AWS Service
  • Hand-on Development with AWS Service

Let me start with remembering our 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.

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 have followed 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

How can learn and develop this project ?

When I developed this project, I have followed several steps to understand and practice and develop this Serverless E-Commerce application. And find the best way to learn and practice this project with break-down the stages that I can understand well and put new learnings on base information.

Basically Course structure will be divide by 2 main parts;

  • Exploring AWS Service Parts
  • Hands-on Development Parts

These main 2 part also break down by 2.

Exploring AWS Service Parts

  • Learn Theoretical Information
  • AWS Console Walkthrough Demo

Hands-on Development Parts

  • Infrastructure Development with AWS CDK
  • Application Development with NodeJS using AWS SDK

So lets examine all parts one by one; We will start with exploring parts;

Part 1 — Learn Theoretical Information

We will start with learning Theoretical Information, This is overview and detail theoretical information of the topic.

For example if we talk about AWS SQS, we will see

  • SQS
  • Overview
  • Core Concepts
  • Example Use Cases
  • Main Features
  • Visibility Timeout
  • Batch Processing
  • Type of SQS — FIFO, Standard
  • Best Practices of SQS
  • Patterns of SQS
  • Fanout one-to-many pattern
  • Fire & Forget
  • Deep Features

So in this part, we give general information about AWS SQS with features and use cases.

Part 2 — AWS Console Walkthrough Demo

In this part we will make a demo with Walkthrough of AWS Management Console. We will map theoretical information with the AWS Management Console. And perform tasks with AWS Management Console.

For example of AWS SQS,

  • Create SQS on Console
  • Set visibility timeout
  • Send message to queue
  • Poll message to queue
  • Set DLQ for SQS Queue

So in this part, we practice general information with using AWS Management Console with AWS SQS features and use cases.

After these exploring part, we will start with Hands-on Development and Testing Part.

Hands-on Development and Test

These part divide also by 2;

  • Infrastructure Development with AWS CDK
  • Application Development with NodeJS using AWS SDK

Part 3 — Infrastructure Development with AWS CDK

This part is Serverless Infrastructure Development with using AWS CDK Typescript IaC- Infrastructure as Code. First of all, we are going to develop Serverless Infrastructure with AWS CDK project which written typescript code.

For example if we talk about AWS SQS, we will see Developing AWS CDK typescript code for AWS SQS and provision it;

export class SwnQueue extends Construct {public readonly orderQueue: IQueue;constructor(scope: Construct, id: string, props: SwnQueueProps) {
super(scope, id);
//queue
this.orderQueue = new Queue(this, ‘OrderQueue’, {
queueName : ‘OrderQueue’,
visibilityTimeout: Duration.seconds(30) // default value
});
props.consumer.addEventSource(new SqsEventSource(this.orderQueue, {
batchSize: 1
}));
}
}

You can see example AWS SQS create operation at above code block with using AWS CDK Typescript IaC- Infrastructure as Code.

Part 4 — Application Development with NodeJS using AWS SDK

This part is Microservices Lambda Function Development with NodejJS Lambda Functions using AWS SDK for JavaScript v3. After finished to development of infrastructure, we will develop our microservices with NodeJS Lambda Functions using AWS SDK for JavaScript v3.

For example if we talk about AWS SQS in our Serverless E-commerce application, we will see Developing Ordering Microservice poll event queue business logic with AWS SDK;

exports.handler = async function(event) {
console.log(“request:”, JSON.stringify(event, undefined, 2));
if(event.Records != null) {
// SQS Invocation
await sqsInvocation(event);
}
else if (event[‘detail-type’] !== undefined) {
// EventBridge Invocation
await eventBridgeInvocation(event);
} else {
// API Gateway Invocation — return sync response
return await apiGatewayInvocation(event);
}
};
const sqsInvocation = async (event) => {
console.log(`sqsInvocation function. event : “${event}”`);
event.Records.forEach(async (record) => {
console.log(‘Record: %j’, record);
const checkoutEventRequest = JSON.parse(record.body);
// create order item into db
await createOrder(checkoutEventRequest.detail); // detail object should be checkoutbasket json object
});
}
const eventBridgeInvocation = async (event) => {
console.log(`eventBridgeInvocation function. event : “${event}”`);
// create order item into db
await createOrder(event.detail);
}
const createOrder = async (basketCheckoutEvent) => {
try {
console.log(`createOrder function. event : ${basketCheckoutEvent}”`);
// set orderDate for SK of order dynamodb
const orderDate = new Date().toISOString();
basketCheckoutEvent.orderDate = orderDate;
console.log(basketCheckoutEvent);
const params = {
TableName: process.env.DYNAMODB_TABLE_NAME,
Item: marshall(basketCheckoutEvent || {})
};
const createResult = await ddbClient.send(new PutItemCommand(params));console.log(createResult);
return createResult;
} catch(e) {
console.error(e);
throw e;
}
}

You can see example AWS Lambda Handler function that receive queue messages from AWS SQS with using AWS SDK for JavaScript v3.

Example of AWS SQS Way of Learning

So that mean we will follow these steps :
Part 1 — AWS SQS Overview
Part 2 — AWS SQS Walk Trough Step by Step Tutorial over Console
Part 3 — AWS SQS Infrastructure as Code Development with AWS CDK
Part 4 — Developing AWS SQS Interaction with Ordering Microservices using AWS SDK

For example of AWS SQS

1 — AWS SQS Overview
2 — AWS SQS Walk Trough Step by Step Tutorial over Console
3 — We will develop AWS CDK Typescript code for AWS SQS and provision it in our infrastructure and verify to see on AWS Management Console.
4 — After that we will interact with communicate AWS SQS and Ordering Microservices. Ordering Microservices polling messages from AWS SQS.

As the same example we can give Lambda microservices — DynamoDB and EventBridge.
First we should create infrastructure of DynamoDB and EventBridge. After that we will interact these DynamoDB and EventBridge into Basket Lambda function code.

AWS Serverless Microservices for Ecommerce Application Architecture

Here, you can find the main overall Serverless Architecture for our application that we will follow these steps and build this Serverless E-Commerce Microservices Architecture.

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.

--

--

Mehmet Ozkaya
AWS Serverless Microservices with Patterns & Best Practices

Software Architect | Udemy Instructor | AWS Community Builder | Cloud-Native and Serverless Event-driven Microservices https://github.com/mehmetozkaya