Skip to content

#62_Running_ASP_dot_NET_on_AWS

sardap edited this page Apr 4, 2019 · 2 revisions

Spike #62 - Running ASP .NET on AWS

Shane Vincent - 03/04/2019 Nhi Nguyen - 03/04/2019

Goals / Deliverables

There are several systems that we could use to run .NET core on AWS. Any selected must meet these requirements:

  • Must be able to run .NET Core
  • Must have support for .NET Core identity
  • Must be able to get access to a web server and database

Have decided to use AWS Elastic Beanstalk

  • Can run .NET Core
  • Apps running on AWS Elastic Beanstalk can be made with Cognito
  • Can run coupled with AWS RDS (database) and a web server

Technologies, Tools and Resources Used

What we found out

How to setup an AWS Elastic Beanstalk server: Requirements:

  • An AWS account

Costs:

  • Cost estimate is $0.09 to setup the server, assuming we follow the recommended configurations, and that we terminate all resources within 1 hour of completing the project.
  • It is predicted to cost roughly $53 to run the server constantly for a month.

Creating the environment

  • Open the Elastic Beanstalk Console

  • For Platform, select .NET from the dropdown.

  • When setting up a sample environment, I setup a Sample application as the Application Code. Here, it is possible to upload our own .NET code.

  • Click Review and Launch.

Adding a database (RDS) to the environment (May not be required)

  • Select Modify under the Database tab.
  • If loading from a database snapshot, select that from the Snapshot dropdown.
  • Enter a Username and Password.
  • If you plan on loading this database again in the future, select Create Snapshot from the Retention dropdown. Otherwise, select Delete.
  • Click Save.
  • Click Create App to create the environment

Creating the environment will take about 10 minutes to complete. Once it is completed, the environment information that is displayed at the top of the page will reveal the URL of the web server that is running: (here)[http://tutorials-env.xg7ncc92bz.us-east-2.elasticbeanstalk.com] image

Navigate to the URL and this message will be displayed if the server is running successfully: image

Uploading to the Server

Code can be uploaded and deployed straight on the web interface or can be deployed through the AWS toolkit for Visual Studio.

Upload from the web interface

  • Go to aws.amazon.com and login.
  • Select Elastic Beanstalk from the Services tab.
  • Click on the environment that is running.
  • Click on the Upload and Deploy button.
  • Select a source bundle you wish to upload and give it a label. In order to create a source bundle, follow the instructions here
  • There are more options available under Deployment Preferences. Investigate them to see if they are anything you are interested in when deploying.
  • Click on the Deploy button.
  • While the application is deploying: image

Visual Studio's AWS toolkit

  • Download and configure the AWS Visual Studio Toolkit image

  • In Visual Studio, open your project.

  • On the View Menu, choose Solution Explorer.

  • Expand the Solution of your project.

  • Right click on your App and then select Publish to AWS. image

  • On the Publish to AWS Elastic Beanstalk page, for Target Deployment, choose the environment that we have created, then click Next. image

  • On the Application Options page, accept all of the defaults and then choose Next.

  • On the Review page, choose Deploy.

  • After deployment, the Output box displays feedback. image

  • Check the Elastic Beanstalk Console to see if the application was successfully deployed.

Terminating the Environment

If you wish to terminate the environment. If you are interested in saving the database in a snapshot, ensure that in the configuration of the database it is set to be snapshotted, rather than deleted.

Clone this wiki locally