Harshil
Harshil

Reputation: 484

How to convert an MVC 4 Project into AWS Lambda Function?

I have written a small UI in MVC4 - Razor Engine (Visual Studio 2015). This works perfectly fine when hosted on IIS. It is a small utility where user uploads an image and in the background, I make call to a few services using suitable payload.

What I don't understand is that how do I host this as a AWS Lambda function. Do I create a new AWS Lambda Project and rewrite my code? Or should I simply "Publish to AWS Elastic Beanstalk". Are Lambda functions(AWS) and apps hosted on AWS Elastic Beanstalk, serverless?.

My end goal is to host my Web app (created in Visual Studio) on AWS in a serverless manner. How do I go about it. New to the world of AWS.

A few videos that I have seen include:

https://www.youtube.com/watch?v=6qwG5ufO1ik and https://www.youtube.com/watch?v=Ymn6WGCSjE4

Thanks in advance.

EDIT: I see that we can simply return html page in response from AWS lambda Function Handler. Can we in the same way, return javascript as well ?

Upvotes: 4

Views: 3675

Answers (2)

Aaron Hudon
Aaron Hudon

Reputation: 5839

Convert your MVC4 app to .NET Core, and have at it!

https://aws.amazon.com/blogs/developer/serverless-asp-net-core-2-0-applications/

Upvotes: 0

E.J. Brennan
E.J. Brennan

Reputation: 46879

You can't move a UI related application to Lambda, Lambda has nothing to do with the UI.

If you want your application to be 'serverless', you could migrate your visual elements to a static HTML page and host that on S3 and then you could rewrite any of the back-end functionality in Lambda, but simply moving a UI centric MVC app to Lambda is not possible.

Upvotes: 4

Related Questions