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
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: 0.0.0.0/0 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="server=RDS-reinvent2018rds.cfps0xbo61a.eu-central-1.rds.amazonaws.com;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
3.3 - Perform a backup of the SQL database (Reinvent2018) running on the localhost
3.4 - Perform the backup as shown below, click OK
3.5 - Upload the SQL database backup file to your S3 bucket you created in step 3.1
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:
Description: option group for dev331
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
Then click Connect
3.10 - Preform the restore
Open a New Query and execute the following code:
exec msdb.dbo.rds_restore_database @restore_db_name='ReInvent2018', @s3_arn_to_restore_from='arn:aws:s3:::<replace_with_your_bucket_name>/ReInvent2018.bak';
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:
(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