Best architecture for .NET + REACT in AWS ?

0

I am building a web application with React + .NET Web API + SQL Server. I want to host them on AWS but i' am confused about how to do it. From my research I have these options:

  • EC2 machine where I host everything, a bit more costly and I have to manually configure all other services, like AWS CloudFront.

  • AWS Elastic Beanstalk for .NET + AWS S3 for REACT + CloudFront: To be honest I am confused if my website is a static website, having a backend, so I am not sure about this architecture.

  • AWS Elastic Beanstalk + AWS Amplify: Here I am not sure if I could use only Beanstalk or only Amplify to host my web app.

What do you think ?

2 Answers
0

Hi Daniel -

A lot depends on what you mean by .NET for the back-end. Is this .NET Framework (which is Windows only), or are you building on a modern version of .NET (like .NET 6 or .NET 8) which run on Linux, including on AWS Lambda, our serverless platform?

If you are using the older Windows-only .NET Framework, then using AWS Amplify and Elastic Beanstalk is a good option. You would use Amplify to build and deploy your front-end is a good option - although you could also just build a React app and deploy it (the front-end, including HTML, JavaScript, CSS, images, etc) to an Amazon S3 bucket manually. But Amplify automates the CI/CD for your front end.

If you're building a new .NET application, I strongly recommend you use .NET 8, the current version. This allows you to build your back end in AWS Lambda (serverless) or using Linux containers in ECS or EKS. AWS Amplify has built-in support for .NET (aka ".NET Core"), and will deploy your back end for you as well as the front-end. This is the blog that announced the .NET support (note: it's from 2020, so things may have changed a bit): Introducing .NET Core Support for AWS Amplify Backend Functions. The blog deploys the back-end .NET code to AWS Lambda.

You can learn more about how AWS Amplify works here: How Amplify works - concepts.

profile pictureAWS
Kirk_D
answered 5 months ago
  • It's .NET 8. So the AWS architecture would be Amplify for hosting and deploying the React front end plus deploying the .NET solution, and as a hosting model for .NET, ECS/EKS or AWS Lambda ?

0

Hello Daniel,

You can have a static website on the frontend while having APIs provided by your backend. It is not an uncommon pattern. Usually host your assets on a CDN like CloudFront is always a great idea: you place resources that can be reused closer to your user and you don't need to generate it at each access.

For your scenario I think the best option you have is the second one. The Amplify option is not feasible since you'll need your .NET running in the back right? (I assume yes). And in the end Amplify is a way for JavaScript frameworks, using or not SSR (Server Side Rendering in Node), can be hosted on a CloudFormation distribution with the files on S3.

I would not recommend EC2 because of the admin overhead you'll have with all the services. Beanstalk even will help with Blue/Green deployments.

So your best option is following our guide on .NET for Beanstalk.

profile pictureAWS
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions