Step-by-Step Guide to Deploying .NET MVC Applications on AWS Elastic Beanstalk

AWS, How to By May 25, 2023 No Comments

deploying a .NET MVC application to AWS Elastic Beanstalk can be broken down into several steps.

Prerequisites:

Before you begin, you’ll need the following:

  1. An AWS account. If you don’t have one, you can sign up for a free tier.
  2. AWS CLI installed and configured on your system. You can download it from here.
  3. The .NET MVC application you want to deploy.
  4. Visual Studio installed on your system. You can download it from here.

Steps to deploy a .NET MVC application on AWS Elastic Beanstalk:

  1. Create a new Elastic Beanstalk Environment:
    • Go to the AWS Management Console and open the Elastic Beanstalk console.
    • Click “Create New Environment”.
    • Select “Web server environment”, then click “Select”.
    • In the Environment Information step, provide the required details like Environment Name, Domain, etc. Then click “Next”.
    • In the Base Configuration step, select Preconfigured platform as .NET (Windows/IIS)” and then click “Create environment”. AWS will then take a few minutes to set up your new environment.
  2. Create an AWS Elastic Beanstalk Application:
    • Once your environment is set up, go back to the Elastic Beanstalk console and click “Create a new application.
    • Fill in the necessary details and click “Create”.
  3. Deploy the application:
    • First, you need to package your .NET application into a .zip file. You can do this from Visual Studio by right-clicking on your project and selecting “Publish”.
    • Choose a publish target as “Folder” and select a destination folder. Once you have published your project, locate the folder and compress all the files into a .zip file.
    • Go back to your environment on the Elastic Beanstalk console. Click “Upload and Deploy”.
    • Click “Upload” and browse to your .zip file. Then click “Deploy”.
    • AWS Elastic Beanstalk will then deploy your application and handle capacity provisioning, load balancing, scaling, and application health monitoring.
  4. Access the Application:
    • Once your app is deployed, click the URL at the top of the dashboard. It should load your application in a new tab.

Remember, Elastic Beanstalk is just one way to deploy your .NET MVC application on AWS. Other options include EC2 instances, AWS Lambda, and more. The right choice depends on your specific needs.

The aws-windows-deployment-manifest.json file tells AWS Elastic Beanstalk how to deploy your .NET application. It can be used to define the components of your application and their sources, and to configure IIS settings.

Here’s a typical example of a .NET MVC deployment manifest:

{
  "manifestVersion": 1,
  "deployments": {
    "aspNetCoreWeb": [
      {
        "name": "app",
        "parameters": {
          "appBundle": "SampleAspNetApp.zip",
          "iisPath": "/",
          "iisWebSite": "Default Web Site"
        }
      }
    ]
  }
}

In this example:

  • manifestVersion is always 1.
  • deployments specifies what is being deployed.
  • aspNetCoreWeb indicates that we’re deploying an ASP.NET Core web application.
  • name is a friendly name for this particular deployment.
  • parameters specifies details of the deployment.
  • appBundle is the filename of the .NET application bundle, which is a .zip file created when you published your app.
  • iisPath is the virtual path on the IIS server where your app will be served.
  • iisWebSite is the website on the IIS server where your app will be deployed. By default, this is “Default Web Site”.

The manifest file must be placed in the root of your .zip file along with your published .NET application. When AWS Elastic Beanstalk deploys your application, it reads the manifest file and deploys your app accordingly.

Please note that the format of the manifest file can change depending on the .NET version and your specific needs. Also, it’s important to make sure your AWS Elastic Beanstalk environment is configured to run the correct version of .NET.

Author

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

No Comments

Leave a comment

Your email address will not be published. Required fields are marked *