Migrate an ASP.NET web application to AWS Elastic Beanstalk

with the interactive Windows Web Application Migration Assistant (WWAMA)

Overview

The purpose of this lab is to migrate a sample ASP.NET web application to a fully managed AWS Elastic Beanstalk environment using the Windows Web Application Migration Assistant (WWAMA). Additional information about the Windows Web Application Migration Assistant is available here.

Expected Outcome

You will migrate a sample ASP.NET web application to a fully managed AWS Elastic Beanstalk environment.

Pre-requisites

You will need an AWS account and IAM permissions to create an EC2 instance, Key Pair, Security Group, IAM user, and an Elastic Beanstalk environment. This tutorial will deploy an AWS CloudFormation template that automatically provisions the sample website on an EC2 instance that will be the source web application for the migration.  

About this Tutorial
Time 15 minutes                                           
Cost Free Tier Eligible
Use Case Windows Application Migration
Products AWS Elastic Beanstalk
Audience Developer
Level Beginner
Last Updated 3/30/2020

1. Sign-up for AWS

The CloudFormation template used in this tutorial launches a t2.micro EC2 instance. The t2.micro instance type is part of the Free Tier. If a different instance type is selected, EC2 costs would be incurred. You can estimate EC2 costs on the EC2 pricing page.

 

Already have an account? Sign-in

2. Setting Up and Configuration

Use CloudFormation to launch the EC2 instance that will host the sample website. Then, setup the required IAM permissions.

a. Launch an EC2 instance via CloudFormation

Use CloudFormation to launch an EC2 instance in US-East-1.

Launch the CloudFormation stack >>

Then click Next.

WWAMA - CFN

Select an existing key pair or create a key pair if you do not have one. Then click Next.

WWAMA - 2

On the Configure Stack Options screen, click Next. At the bottom of the Review screen, click Create Stack.  

 

WWAMA - 3

Once the stack has been created, you will see its status change to 'CREATE_COMPLETE'.

 

WWAMA - 5

b. Create the IAM User

Log into the IAM console >>

In the left-hand navigation menu, click Users, then click Add User.

Enter the User name MigrationUser, check the box for Programmatic access, then click Next:Permissions.

WWAMA - 6

Click Attach existing policies directly, and type Beanstalk in the search bar to filter the policies.

Click the checkbox for the following AWS-managed policies, then click Next:Tags.

  • IAMReadOnlyAccess
  • AWSElasticBeanstalkFullAccess

 

WWAMA - 8

Click Next:Review, then click Create User.


 

 

WWAMA - 9

After the user is created, click Download CSV when the screen comes up.

 

 

WWAMA - 10

3. Log into the EC2 console and set up to run the WWAMA tool

a. Navigate to EC2 console and Login

Log into EC2 here >>

Once you've logged into the EC2 console, select the WWAMA instance and click Connect.

WWAMA - launch-instance

Click Download Remote Desktop file and save the RDP file. Then click Get Password and upload your key pair file to get your Widows Server password. You will see the password in plain text - copy it as you'll need it in the next step.

 

 

WWAMA - RDP_LI

Log into the EC2 instance using the RDP file you saved earlier and provide your password.

 

 

b. Open a PowerShell terminal on the EC2 Windows Server

Open a PowerShell terminal as Administrator and run the commands provided in the below-right sample to configure the AWS credentials. Replace ACCESS_KEY and SECRET_ACCESS_KEY with the values in the .CSV downloaded earlier during the creation of the MigrationUser.

 

WWAMA - 13
PS C:\> Import-Module AWSPowerShell
PS C:\> Set-AWSCredential -AccessKey ACCESS_KEY -SecretKey SECRET_ACCESS_KEY -StoreAs default

c. Extract the Migration Assistant files

The migration assistant has been pre-downloaded on the C:\ drive by the CloudFormation template. The file is wwama.zip

Right click on wwama.zip and extract the assistant.

WWAMA - 14

d. View the sample website before migration

Open a web browser on the EC2 Windows Server instance and navigate to http://localhost/. You will see the sample website that the migration assistant will migrate.

WWAMA - localhost_LI

4. Run the Migration Assistant

a. Launch the MigrateIISWebsiteToElasticBeanstalk.ps1 script

In the PowerShell terminal you opened earlier, launch the migration script.

The assistant prompts you for the location of your credentials file. Press ENTER to skip.

When prompted for AWS Profile Name, enter default.

   

PS C:\> .\MigrateIISWebsiteToElasticBeanstalk.ps1

b. Select AWS Region

Enter the AWS Region where you'd like your Elastic Beanstalk environment to run. For example: us-east-1. For a list of AWS Regions where Elastic Beanstalk is available, see AWS Elastic Beanstalk Endpoints and Quotas in the AWS General Reference.

 

Enter the AWS Region (default us-east-1):

c. Select the web application you want to migrate

The assistant then discovers any websites running on your IIS server and lists them, as in the example below.

 

 

WWAMA - 16

Enter the number 2 to migrate the sample site.

Enter the number of the website to migrate: (default 1):

d. Update connection strings

The assistant then prompts you to update any connection strings selected above, press ENTER as there aren’t any connection strings in this application.

This message will appear:

"The migration assistant didn't find any connection strings."

Enter the number of the connection string you would like to update, or press ENTER:

e. Set up your Elastic Beanstalk application

Next, name your new Elastic Beanstalk application.

 

 

When prompted to select the Windows Server version, type ‘6’ and press Enter.

Enter a unique name for your new Elastic Beanstalk application:
WWAMA - 17

Enter instance type that your application will run on. Type t2.micro. See Amazon EC2 Instance Types for a complete list.

Enter the instance type (default t3.medium) : t2.micro

The migration assistant then migrates your application to Elastic Beanstalk.

 

WWAMA - 18

When the migration completes, you will see a success message in the CLI.

 

WWAMA - 19

5. Navigate to your web application hosted on Elastic Beanstalk

Now that the site is successfully migrated, verify that the website is up and running.

a. Access in web browser

You can get the URL from the output of the PowerShell script.

Input the URL into your web browser, and you should see your web application, now running on Elastic Beanstalk.

 

WWAMA - 20
WWAMA - 21

b. Access in the Elastic Beanstalk console

You can also view the Elastic Beanstalk environment from the AWS console. Make sure you're seeing the console for the same region you deployed your application to. Feel free to explore what you can do with your application by using the menu on the left side.

 

WWAMA - 22

6. Cleaning up your resources

In this final step, you'll clean up and delete all your resources.

a. Delete the Elastic Beanstalk application

Go to the Elastic Beanstalk console and click on the Actions menu on the right hand side. Then, select Terminate Environment.

 

 

WWAMA - 22

b. Delete the CloudFormation stack

Go to the CloudFormation console and delete the CloudFormation stack WWAMAStack created at the start of the lab.

 

 

Congratulations

You have successfully migrated a sample ASP.NET web application to a fully managed Elastic Beanstalk environment using the Windows Web Application Migration Assistant (WWAMA).


AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.

You can simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, auto-scaling to application health monitoring. At the same time, you retain full control over the AWS resources powering your application and can access the underlying resources at any time.

Visit AWS Elastic Beanstalk to learn more.

Was this tutorial helpful?

Thank you
Please let us know what you liked.
Sorry to disappoint you
Is something out-of-date, confusing or inaccurate? Please help us improve this tutorial by providing feedback.