Skip to content

Deploying ASP.NET Core using AWS Elastic Beanstalk

Purpose & Background

The purpose of this lab is to demonstrate how you can deploy ASP.NET Core application using AWS Elastic Beanstalk. You will need to have a working AWS account to use this lab.

Lab Exercises

The following exercises should be completed in order for this lab:

  1. Create an ASP.NET Core application
  2. Build and run the application in the Visual Studio
  3. Deploy the app to AWS Elastic Beanstalk
  4. Verify and test your deployment in the Console

Prerequisites

The following are the prerequisites required in order to complete the lab:

  1. Microsoft Visual Studio 2017 or above installed on your computer
  2. AWS Toolkit for Visual Studio 2017
  3. AWS Account and IAM user with security key id and secret code
  4. Internet connection

Part 1 – Create an ASP.NET Core application

You are going to create new ASP.NET core web application

  1. Go to File -> New -> Projects in Visual Studio and select “Web” on the left side and select “ASP.NET Core Web Application” and Click “OK” button Picture 1
  2. In the “New ASP.NET Core Web Application” dialog box, select the “Web Application (Model-View-Controller” and uncheck “Configure for HTTPS” Picture 2
  3. Visual Studio will create the new project

Part 2 – Build and Run the Application

  1. Try to build the new web application to make sure it will run successfully. Picture 3
  2. Run the application to make sure it is ready to be deployed to AWS, Picture 4

Part 3 – Deploy the Application to AWS using AWS Elastic Beanstalk

  1. Right click on the project and click on “Publish to AWS Elastic Beanstalk” Picture 5
  2. In the first window, make sure to select the region that you want to use and select “Create a new application environment” and click “Next” Picture 6
  3. Enter the environment name here in this window and check availability to make sure that the URL is available and then click “Next” Picture 7
  4. In this window, keep all default and click “Next” Picture 8
  5. In the Permissions window, keep all default and click “Next” Picture 9
  6. In the Application Options window, keep all default and click “Next” Picture 10
  7. Check the review window and then click “Deploy” Picture 11
  8. AWS Toolkit will start deploying and launching your web application, Picture 12
  9. After waiting for few minutes, your AWS Beanstalk environment will be ready Picture 13
  10. Click on the URL to run your web application, you will see the following screen Picture 14

Part 4 – Verify and Test your Deployment in the Console

Go to AWS Console and select “Elastic Beanstalk”, make sure to select the same region that you used to deploy your application Picture 15 Click on the environment and see more details Picture 16 You can run your application by using the URL on the top right side of the screen