Skip to content

DEV331 Option 2: Replatform a traditional aspx forms application to EC2 with RDS.

Duration: ~40 minutes
Windows local user: .\developer
Windows local password: ILove.Net!
SQL user: developer
SQL pass: ILove.Net!
Server AMI: ami-0a5f9b6fe6ae097c7
Server Region: EU (Frankfurt)
Development Machine Region: Canada Central

Step 1: Verify the RDS Instance in Frankfurt Region

Navigate to AWS Management Console, select the EU (Frankfurt) region, click on Services and then RDS a
In the left navigation pane, click Instances. a
Note: An RDS Instance named "rds-reinvent2018rds" will be provisioned for you.
Ensure the status is "Available"
Click on the Instance "RDS-reinvent-2018rds" and scroll down to the section named "Connect"

Validate the following details
Endpoint: <Endpoint URL>
Publicly Accessible: Yes
RDS Security Group Rules: Port 1433

Step 2: Go to Visual Studio, update the web.config with following information

server = <whatver-your-rds-endpoint-is>
database = ReInvent2018
uid = developer;
password = ILove.Net!;

Example Connection String:
<add name="myConnectionString" connectionString=";database=ReInvent2018;uid=developer;password=ILove.Net!" />

Step 3: Perform database backup and restore to RDS instance.

3.1 - Create an S3 Bucket in the EU (Frankfurt) region.

In Visual Studio, open the AWS Explorer, change the region to EU (Frankfurt), and select Amazon S3
Right click on Amazon S3, click Create Bucket, in the Create Bucket dialog type a unique name that you will remember, such as dev331-yourname-rds, then click OK

3.2 - Open SSQL Server Management studio and connect to the local machine

First open SQL Server Management Studio and connect to localhost using Windows Authentication

3.3 - Perform a backup of the SQL database (Reinvent2018) running on the localhost

Right click on Reinvent2018 and click on Tasks>Backup

3.4 - Perform the backup as shown below, click OK

(You may need to remove the current backup from c:\Database\ReInvent2018.bak)

3.5 - Upload the SQL database backup file to your S3 bucket you created in step 3.1

In Visual Studio, open the bucket you created with AWS Explorer, click Upload File and navigate to the backup you just created and upload it:

3.6 - Create the options group for the RDS instance

Switch to the AWS Management Console and navigate to Services > RDS
In the navigation pane on the left, choose Option Groups
Choose Create Group

In the Create Option Group window,use the following settings:
Name: dev331-og
Description: option group for dev331
Engine: sqlserver-se
Major engine version: 14.00
Once your screen matches the above, click Create

3.7 - Add an option to the Option Group

Select the option group (dev331-og) you created from the previous step
Click Add option
Keep the defaults and create a new IAM role so that your IAM role has the required privileges. Name the role dev331-rds-role
Choose the S3 bucket in the EU (Frankfurt) region that you created in Step 3.1
Choose Apply Immediately and click Add Option

3.8 - Associate the RDS Instance with the Option Group

Navigate to RDS in the AWS Console
Click to open the RDS instance rds-reinvent2018rds then click Modify
Scroll down to the Database Option section and choose the dev331-og option group
Click Continue and then choose Apply Immediately then click Modify DB Instance
(Note: Once the RDS Instance status changes from Modifying to Available (this will take about 3-5 mintues), proceed further to restore the database)

3.9 - Connect to the RDS instance

On the development machine, open SQL Server Management Studio and use the following settings:
Authentication: SQL Server Authentication
Login: developer
Password: ILove.Net!
Then click Connect

3.10 - Preform the restore

Open a New Query and execute the following code:

exec msdb.dbo.rds_restore_database

Pay particular attention to the task id in the first column

Note:(IF your restore fails for some reason (like a typo), you will need to change the restore_db_name to kick off the job again. If this happens make sure you modify your web.config accordingly)

3.11 - Monitor the restore

execute the following in the query editor replacing the task id for the one that was returned in the previous step:

exec.msdb..rds_task_status @task_id=<your_task_id>

(Note: This restore will take some time, while this is happening feel free to move on to Option 3 and then come back to this later)

Step 4: Publish the application to Elastic Beanstalk.

4.1 – In Visual Studio, right click on the ReInvent2018WebApp and select Publish to AWS Elastic Beanstalk


4.2. On the first screen, the region should be set to EU (Frankfurt), choose Create a new application environment and click Next


4.3. In the application environment screen, modify the application name to be unique, for example add your initials to the end of the name, then select the environment that ends in –dev and click Check availability... If it says “The requested URL is not available” then modify the URL by adding a random number at the end and click Check availability... again.


4.4: In the EC2 Launch Configuration screen, choose the following configuration

Container Type 64bit Windows Server 2008 R2 v 1.2.0 running IIS 7.5
Instance Type t2.medium
Key Pair <no key pair>
Remove the checkbox that says Single instance environment
Select the Security group, under Relational Database Access as shown below. a
Once your screen matches, click the Next button

4.5: In the permissions screen, accept the defaults and click Next:


4.6: In the Application Options screen keep the defaults and click Next:


4.7: On the Review screen, use the defaults and click Deploy, the application should start deploying and show you the progress. Wait for the screen to show you that the deployment has successfully launched and the status is Environment is healthy:


Step 5 – Click on the URL from the Beanstalk deployment and verify that your app is working