Lab 5. Adding EC2 Virtual Machines and Deploying the Web App

Overview

In this lab we are going to going to run our application on the cloud web server, In order to do this we are going to run  EC2 instances as webserver and Queue Server, we have to create policies to attach to our servers we are going to create.

Amazon EC2 

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment.

IAM

AWS Identity and Access Management (IAM) is a web service that helps you securely control access to AWS resources for your users. You use IAM to control who can use your AWS resources (authentication) and what resources they can use and in what ways (authorization).

In this Lab we will learn:

  • How to create Policy by using Policy Generator in IAM
  • How to create an EC2 instance for Web Server and Queue server
  • To publish dinostore application move it from local server to the cloud server.
  • How to install IIS, ASP.NET 4.5, Windows Authentication

The image shown below is the architecture for this lab.

11

To create a policy go to >services> Choose IAM under security,identity and compliance.

Screenshot (49)

Choose policies from the left pane.

Screenshot (50)

Click on Policy Generator.

Screenshot (51)

In set permissions you have to give the following configuration for the policy.

Effect=Allow
AWS Service= Amazon DynamoDB
Actions= deleteitem,describetable,getitem,putitem,updateitem
ARN= Your DynamoDB ARN

When you are done you have to create another policy  with the following configurations

Effect=Allow
AWS Service= Amazon SQS
Actions= deletemessage, deletemessagebatch, getqueueurl,recievemessage,sendmessage,sendmessagebatch
ARN= Your SQS ARNScreenshot (52)

Click on Add Statement

Screenshot (53)

Give the policy name as the DynamoSqsPolicy

Screenshot (54)

In the left pane above to policies you will find Roles click on it.

Screenshot (58)

Select the role type as Amazon EC2 

Screenshot (59)

Attach the policy you created DynamoSqsPolicy

Screenshot (60)

Set the role name as WebserverRole click on Create Role

Screenshot (61)

Now in the EC2 dashboard, launch the new instance.

Screenshot (62)

Pick the free tier Microsoft Windows Server 2012 R2 base.

Screenshot (63)

Choose the instance type as General purpose t2.micro

Screenshot (64)

In the configuration instance details choose the IAM role as WebserverRole

Screenshot (65)

Leave the default settings in Add Storage and click Next.

Screenshot (66)

Tag with a name.

Screenshot (67)

In the configure security Group

Screenshot (68)

select create a new security group and give the security group name as WebRDPGroup. For description type Web or RDP access – created for net701 lab web server ec2 instance.

Add a Rule and select RDP and the source must be your IP address. HTTP should be anywhere(All sources)

Screenshot (69)

Review instance Launch click on Launch.

Screenshot (70)

When you launch remember to save your private Key file.

Screenshot (71)Screenshot (72)Screenshot (73)

Create another launch instance for queue server, select windows server 2012 R2 base

Screenshot (74)

Choose the instance type as general purpose t2.micro

Screenshot (75)

Choose the IAM role as WebServerRole

Screenshot (76)

Keep the default seetings in the Add storage.

Screenshot (77)

Add a tag name.

Screenshot (79)

In the security Group select create a new security group. Give the name as RDPGroup and the description as RDP access – created for net701 lab queue server ec2 instance. RDP source must be your IP address.

Screenshot (80)

Review the instance with the configurations you have given and click on Launch

Screenshot (81)Screenshot (82)

wait till your instances to complete the status checks. To get the windows password right click on the instance you created and click on get windows password

Screenshot (83)

When you click on get windows password you will get a pop-up window as shown below copy your username and the password

Screenshot (84)

right click on your instance and click on connect

Screenshot (85)

Download the remote desktop file and open it. In your computer go to run and type mstsc and copy the public DNS of your instance. click on show more options and select the folder where you have saved your applications files, you have to copy those files in to your webserver instance.

Screenshot (86)

when you logged in to your webserver click on Add roles and features

Screenshot (87)

Click on Next

Screenshot (92)

Select role base or feature base installation

Screenshot (93)

Select your server.

Screenshot (94)

In the Add roles and features wizard select Web Server IIS click on add feature and click on next again.

Screenshot (95)

In features Expand .NET framework 4.5 features and select ASP.NET 4.5

Screenshot (96)

In the roles scroll down and select Windows Authentication and expand application Development and select ASP.NET 4.5

Screenshot (105)

In the confirmation click on Yes.

Screenshot (106)

Click on Install. this might take a while so be patience.

Screenshot (107)Screenshot (108)Screenshot (109)

when the installation is finished go to your visual studio and right click your NET702.Dinostore and click on publish.

Screenshot (110)

Click on Custom.

Screenshot (111)

Select a path you want to save the file.

Screenshot (113)

Click on Publish.

Screenshot (114)

Go to the destination you have and check the files are available.

Screenshot (115)

Now go to your RDP as i have metioned earlier before you log in to your RDP you have give the In the local resources give the driver or the folder where you saved your published folder. Copy it to the desktop of your RDP

Screenshot (116)

Go to your RDS and select your RDS instance go to action and click on See details and select your RDS security group and In the Inbound Rules tab click edit, add two new rules, and save:

Type = All Traffic, Protocol = ALL, Source = ‘YOUR RDPGROUP SECURITY GROUP’ (the name will be something like sg-bd1086d8).
New rule two:
Type = All Traffic, Protocol = ALL, Source = ‘YOUR WEBRDPGROUP SECURITY GROUP’ (the name will be something like sg-bd1086d8).

12

Open your IIS manager Highlight the your website in the connection pane and go to content view and right click on Default.aspx and select browse.

1

Now try it on your public Internet.

2

Now go to your visual Studio again and right click on NET702.Dinostore.OrderProcessor click on publish. Save it somewhere you can find it.

3

Click on From CDROM or from DVD ROM

4

Check the files have been saved properly.

5

Go to your RDP and double click on setup

6

Now go yo your Dinowebsite and make an order.

78

Go to your Queue Server check the Application you installed it will show the polling queue, when you make an order it will show the order.

9

Go to your workbench and check if the order has been placed

10

When all these steps are done successfully you have completed Lab 5.

Conclusion

By the end of this lab you have learned:

  • How to create Policy by using Policy Generator in IAM
  • How to create an EC2 instance for Web Server and Queue server
  • To publish dinostore application move it from local server to the cloud server.
  • How to install IIS, ASP.NET 4.5, Windows Authentication

Budget

With On-Demand instances you only pay for EC2 instances you use. The use of On-Demand instances frees you from the costs and complexities of planning, purchasing, and maintaining hardware and transforms what are commonly large fixed costs into much smaller variable costs. For my instance they will charge as on demand pricing. For t2.micro they will charge $0.012 Per hour.

Note: Always TurnOff your instances, Otherwise they would keep on charging you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s