Launching EC2 Instance in aws

Create an EC2 instance, connect to it from your local system and install apache web server on the EC2 instance. 1. In the AWS console, under compute service, select EC2 2. In the subsequent screen that is displayed, select instances. 3. In the instances screen, select “Launch instances” 4. From the “Choose an Amazon Machine Image (AMI) screen, select Amazon Linux 2 AMI. You can select any amazon machine image. You can scroll down the screen and see various different options available like Ubuntu server, Red Hat Linux, Windows 2019 Server etc. 5. From the subsequent “Choose instance type” screen, you can select instance types based on your requirements. You can get different instance type based on CPU, Memory, storage. For the hands-on session, please select t2.micro which is free tier eligible. Other instance types are chargeable. 6. After selecting instance type, click on the “next : Configure instance Details” button 7. In the “Configure Instance Details” screen, you have options to specify the numbers of instances, auto scaling group, VPC, Subnet etc. For the hands-on session, accept all default and do not make any changes and click on the “Next: Add Storage” button. 8. In the “add storage screen”, you can see the storage available for your instance type, if you want you can add additional storage for your instance. For the hand-on, go with the default storage available for your instance and do not add any additional storage. Click on the 9. “Next : Add Tags “ button to proceed further. 10. In the “Add Tags” screen, you can add Tags for your instance if you want by clicking on the “Add Tag” button. 11. You can give a tag, and press on “Next: Configure Security group” button. 12. In the “Configure Security Group” screen, you can see the default security group configuration, which allows only inbound traffic through SSH at port 22. For hands-on please accept the default settings available and click on the “Review and Launch” button 13. “Review Instance Launch” screen gives all the options and configurations you have done. You can click on the “Launch” button to launch the instance. 14. On clicking “Launch” button, you will be presented with a dialog box asking you to select the key pair which is required to connect to the instance. If you already have a key pair, you can use that, else you have to create a new key pair by selecting create a new key pair. 15. Give a name for the key pair and click on the “Download Key Pair” button. 16. Once the key pair is downloaded, “Launch Instance” button will be enabled and you can click on the “Launch Instance” button to launch the instance. 17. Once “Launch Instance” button is clicked, you will get the screen shown below. 18. Now you can go back to the Instance screen, and check the status of the instance. 19. Once you are in the instance screen, you can see that the instance is running as shown by the screen below. This indicates your instance is up and running. Connecting to the EC2 instance. 1. Copy the key pair you download in step 15 to any folder in you system. The downloaded key pair will be having an extension of .pem. 2. Launch the command prompt in your system and move to the folder where you have copied the key pair. 3. Click on your EC2 instance 4. You will get the screen as shown below. Copy the public IPV4 address from the instance details screen. 5. Issue the SSH command in the command prompt in the below mentioned format. Ssh -i ec2-user@ Ssh -i demokey.pem ec2-user@18.190.28.70 You will get an error saying “WARNING: UNPROCTECTED PRIVATE KEY FILE” as shown below. 6. Go to the folder in the explorer where you have kept your key pair file. Right click in the PEM file and take properties and select security tab and click on the “Advanced” button. 7. Make sure that the Owner of the key pair file is you only. Else change it and make yourself as the file owner. 8. Click on “Disable Inheritance” button. 9. On clicking “Disable inheritance” button, you will get the dialog box shown below. 10. Select “Remove all inherited Permissions from this object”. After selecting the option the “Advanced Security Settings” dialog box looks like the one shown below. 11. Click on the “Add” Button 12. On clicking “Add” button you will get the screen shown below. Click on the “Select a principal” option. 13. On selecting “Select a principal” option, you will get the screen shown below. Enter your name in the “Enter Object name” text box and click on the “Check Names” Button. 14. Your name will be identified by the windows as shown below. 15. Click on Ok. 16. In the subsequent screen, give full control and click ok. 17. Give Ok in the subsequent screens. 18. Now Issue the command in the format shown below Ssh -i ec2-user@ Ssh -i demokey.pem ec2-user@18.190.28.70 19. You will be connected to the instance as shown by the screen below. Installing Apache web server. 1. For installing Apache Web server, first update the packages in the instance by issuing the below commands a. Sudo yum update -y b. Sudo yum install httpd -y c. sudo systemctl start httpd 2. Now go to the instance screen, select the security tab and click on the security group. 3. In the “Inbound rules” tab click on “Edit inbound rules” 4. Click on “Add rule” button as shown below. 5. Add the highlighted rule for HTTP access and hit on the “Save rules” button as shown by the below screen. 6. Now type the public IPV4 address on the browser url bar and you should get the below shown screen.

Comments

Popular posts from this blog

Courses After 10th Class – The Ultimate Guide