April 24, 2024
Voiced by Polly

Immediately, I’m pleased to announce {that a} new open-source sample application, a fictitious used books eCommerce retailer we name Bob’s Used Books, is on the market for .NET builders working with AWS. The .NET advocacy and improvement groups at AWS speak to clients commonly and, throughout these conversations, usually obtain requests for extra in-depth samples. Clients inform us that, whereas small code snippets serve properly as an example the mechanics of an API, their improvement groups additionally want and need to make use of fuller, extra real-world samples to grasp higher how one can assemble fashionable functions for the cloud. Immediately’s pattern utility launch is in response to these requests.

Bob’s Used Books is a pattern eCommerce utility constructed utilizing ASP.NET Core model 6 and represents an preliminary modernization of a typical on-premises customized utility. Representing a primary stage of modernization, the appliance makes use of fashionable cross-platform .NET, enabling it to run on each Home windows and Linux methods within the cloud. It’s typical of what many .NET builders are simply now going by means of, porting their very own functions from .NET Framework to .NET utilizing freely obtainable instruments from AWS such because the Toolkit for .NET Refactoring and the Porting Assistant for .NET.

Bob's Used Books sample application homepage

Pattern utility options
Clients of our fictional bookstore can browse and search on the shop for used books and look at particulars on chosen books resembling worth, situation, style, and extra:

Bob's Used Books sample application search results page, which shows 8 books and their prices.


Bob's Used Books sample application book details page

Identical to an actual e-commerce retailer, clients can add books to a purchasing cart, pending subsequent checkout, or to a private want listing. When the time involves buy, the client can begin the checkout course of, which is able to encourage them to sign up if they’re an present buyer or enroll through the course of.

Bob's Used Books sample application checkout page

On this pattern utility, the bookstore’s employees makes use of the identical net utility to handle stock and buyer orders. Position-based authentication is used to find out whether or not it’s a employees member signing in, by which case they’ll view an administrative portal, or an everyday retailer buyer. For workers, having accessed the admin portal, they begin with a dashboard view that summarizes pending, in-process, or accomplished orders and the state of the shop’s stock:

Bob's Used Books sample application staff dashboard page

Workers can edit stock so as to add new books, full with cowl photos, or alter inventory ranges. From the identical dashboard, employees also can view and course of pending orders.

Bob's Used Books sample application staff order processing page

Not proven right here, however one thing I believe is fairly cool, is a simulated workflow the place clients can re-sell their books by means of the shop. This includes the client submitting an utility, the shop admin evaluating and deciding whether or not to buy from the client, the client “posting” the e book to the shop if accepted, and eventually the admin including the e book into stock and reimbursing the client. Keep in mind, that is all fictional, nonetheless—no precise monetary transactions happen!

Utility structure
The bookstore pattern didn’t begin as a .NET Framework-based utility that wanted porting to .NET, nevertheless it does use a monolithic MVC (model-view-controller) utility design, typical of the .NET Framework improvement period (and nonetheless in use at present). It additionally makes use of a single Microsoft SQL Server database to comprise stock, purchasing cart, consumer information, and extra.

Bob's Used Books sample application outline architecture

When totally deployed to AWS, the appliance makes use of a number of companies. These present sources to host the appliance, present configuration to the working utility, and in addition present helpful performance to the working code, resembling picture verification:

  • Amazon Cognito – used for buyer and bookstore employees authentication. The appliance makes use of Cognito‘s Hosted UI to supply sign-in and sign-up performance.
  • Amazon Relational Database Service (RDS) – manages a single Microsoft SQL Server Specific occasion containing stock, buyer, and different typical information for an e-commerce utility.
  • Amazon Easy Storage Service (Amazon S3) – an S3 bucket is used to retailer cowl photos for books.
  • AWS Techniques Supervisor Parameter Retailer – comprises runtime configuration information, together with the identify of the S3 bucket for canopy photos, and Cognito consumer pool particulars.
  • AWS Secrets and techniques Supervisor – holds the consumer and password particulars for the underlying SQL Server database in RDS.
  • Amazon CloudFront – gives a website for accessing the duvet photos within the S3 bucket, which implies the bucket doesn’t should be publicly obtainable.
  • Amazon Rekognition – used to confirm that cowl photos uploaded for a e book don’t comprise objectionable content material.

The appliance is a place to begin to showcase additional modernization alternatives sooner or later, resembling adopting purpose-built databases as an alternative of utilizing a single relational database, decomposing the monolith to make use of microservices (for the latter, AWS gives the Microservice Extractor for .NET), and extra. The .NET improvement, advocacy, and resolution architect groups right here at AWS are fairly excited on the alternatives for brand new content material, utilizing this pattern, as an example these modernization alternatives within the upcoming months. And, because the pattern is open-source, we’re additionally to see the place the .NET improvement neighborhood takes it relating to modernization.

Working the appliance
My colleague Brad Webber, a Options Architect at AWS, has written the primary in a sequence of technical weblog posts we’ll be publishing in regards to the pattern. You’ll discover these on the brand new .NET on AWS weblog channel. In his first put up, you’ll study extra about how one can run or debug the appliance by yourself machine in addition to deploy it utterly to the AWS cloud.

The appliance makes use of SQL Server Express localdb instance for its database wants when working outdoors the cloud, which implies you do presently should be utilizing a Home windows machine to run or debug. Launch profiles, accessible from Visible Studio, Visible Studio Code, or JetBrains Rider (all on Home windows), are used to pick out how the appliance runs (for instance, with no or some cloud sources):

  • Native – When you choose this launch profile, the appliance runs utterly in your machine, utilizing no cloud sources, and doesn’t want an AWS account. This allows you to examine and experiment with the code incurring no fees for cloud sources.
  • Built-in – Whenever you use this profile, the appliance nonetheless runs domestically in your Home windows machine and continues to make use of the localdb database occasion, however now additionally makes use of some AWS sources, resembling an S3 bucket, Rekognition, Cognito, and others. This profile allows you to find out how you should utilize AWS companies inside your utility code, utilizing the AWS SDK for .NET and varied extension libraries that we distribute on NuGet (for a full listing of all obtainable libraries you should utilize when growing your functions, see the .NET on AWS repository on GitHub). To allow you to arrange the cloud sources wanted by the appliance when utilizing this profile, an AWS Cloud Growth Equipment (AWS CDK) venture is supplied within the pattern repository, making it simple to arrange and tear down these sources on demand.

Deploying the Pattern to AWS
You can even deploy your complete utility to the AWS Cloud, on this case, to digital machines in Amazon Elastic Compute Cloud (Amazon EC2) with a SQL Server Specific database occasion in Amazon Relational Database Service (RDS). The deployment makes use of sources suitable with the AWS Free Tier however do notice, nonetheless, that you could be nonetheless incur fees in the event you exceed the Free Tier limits. In contrast to working the appliance by yourself machine, which requires Home windows due to the localdb dependency, you may deploy the appliance to AWS from any machine, together with these working macOS and Linux. As soon as once more, a CDK venture is included within the repository to get you began, and Brad’s weblog put up goes into extra element on these steps so I received’t repeat them right here.

Utilizing digital machines within the cloud is usually a primary step in modernizing on-premises functions due to similarity with an on-premises server setup, therefore the explanation for supporting Amazon EC2 deployments out-of-the-box. Sooner or later, we’ll be including content material exhibiting how one can deploy the appliance to container companies on AWS, resembling AWS App Runner, Amazon Elastic Container Service (Amazon ECS), and Amazon Elastic Kubernetes Service (EKS).

Subsequent steps
The Bob’s Used Books sample application is available now on GitHub. We encourage you, in the event you’re a .NET developer engaged on AWS and searching for a deeper, extra real-world pattern, to clone the repository and take the appliance for a spin. We’re additionally interested by what modernization journeys you’d determine to take with the appliance, which is able to assist us create future content material for the pattern. Tell us within the issues section of the repository. And if you wish to contribute to the pattern, we welcome contributions!