This repository contains a sample implementation of Fanout Architecture using .NET6 Worker Services to process messages from Amazon Simple Notification Service (SNS) Topic and Amazon Simple Queue Service (SQS) Queue. Since the Worker Services would have no UI, to operate this solution, you need Observability implemented. In this repository, you can also find sample .NET Observability implementation using the combination of AWS X-Ray and Amazon CloudWatch. To provision this solution, you can use AWS Cloud Development Kit (AWS CDK) to implement your modern Infrastructure as Code, using .NET C# to provision all AWS Resources your application needs.
Componets:
- .NET6 Web API Microservices - Demo Web API to simulate end-user requests.
- .NET6 Worker Service 1 - Demo Worker Services that persist on DynamoDB.
- .NET6 Worker Service 2 - Demo Worker Services that persist on S3.
- SNS - Fully managed pub/sub messaging for asynchronous processing.
- SQS - Fully managed message queues for microservices.
- Amazon DynamoDb Table - Fast, flexible NoSQL database service for single-digit millisecond performance at any scale.
- Amazon Simple Storage Service (Amazon S3) Bucket - Object storage built to retrieve any amount of data from anywhere.
- AWS X-Ray - Analyze and debug production, distributed applications.
- Amazon CloudWatch - Observability of your AWS resources and applications on AWS.
- Amazon Elastic Container Registry (Amazon ECR) - Easily store, share, and deploy your container software anywhere.
- AWS CDK - Define cloud infrastructure using familiar programming languages (C#)
Before exploring the code, please ensure you have the following tools to deploy and see the demo working.
This path is for those not interested in the details of the steps executed to deploy the solution. You can run the script as instructed below and jump into the test.
For: [Bash]
./deploy.sh
For: [Powershel]
.\deploy.ps1
After completing the deployment, you can copy the printed URL like http://WebAp-demos-XXXXXXXXXXXX-9999999999.us-west-2.elb.amazonaws.com and jump to test
To begin the tests, copy the URL printed by the deployment script. It will look like: “http://WebAp-demos-XXXXXXXX-99999999.us-west-2.elb.amazonaws.com”. Make a POST request to the endpoint http://YOUR_ALB_URL/api/Books using your favorite REST API Client, sending the following JSON payload. You can send multiple requests to have some sample data to visualize the Observability result from AWS CloudWatch console.
{
"Year" : 2022,
"Title": "Demo book payload",
"ISBN": 12345612,
"Authors": ["Author1", "Author2"],
"CoverPage": "picture1.jpg"
}
To see the results, open the AWS Console and navigate to CloudWatch and select the option Traces from the left navigation menu, then go to the end of the page use one of the Trace ID you got from the POST Result you should see a picture like the one bellow.
After exploring this solution, please remember to clean up, here's the script to help clean up.
Using: [Bash]
./clean.sh
Using: [PowerShell]
.\clean.ps1
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.