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.
You will migrate a sample ASP.NET web application to a fully managed AWS Elastic Beanstalk environment.
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|
|Cost||Free Tier Eligible|
|Use Case||Windows Application Migration|
|Products||AWS Elastic Beanstalk
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.
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.
Then click Next.
On the Configure Stack Options screen, click Next. At the bottom of the Review screen, click Create Stack.
Once the stack has been created, you will see its status change to 'CREATE_COMPLETE'.
b. Create the IAM User
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.
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.
Click Next:Review, then click Create User.
After the user is created, click Download CSV when the screen comes up.
a. Navigate to EC2 console and Login
Once you've logged into the EC2 console, select the WWAMA instance and click Connect.
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.
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.
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.
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.
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.
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:
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.
When the migration completes, you will see a success message in the CLI.
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.
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.
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.
b. Delete the CloudFormation stack
Go to the CloudFormation console and delete the CloudFormation stack WWAMAStack created at the start of the lab.
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.