Monday, October 26, 2020

AWS Assignment

               AWS Assignment


Objective 


At the end of this assignment you will have created a web site using the following Amazon Web Services: EC2, EBS, ELB and S3. 

  

Stage 1: Building the EC2 web server. 


Launch an EC2 instance, based on Linux or Windows, to meet the following objectives: 

  •  the instance should be of type t2.micro.
  •  the instance should reside within region ap-south-1(Mumbai) within availability zone                   ap-south-1a.
  •  the instance should use a 1 GiB attached EBS volume and contain a valid partition                        table with  one partition. The partition should contain a valid file system, 
  •  the file system residing on the EBS volume should be mounted automatically upon  reboot of   the EC2 instance.  
  •  the instance should serve web pages via an appropriate service such as Apache or IIS ,This service should start automatically upon boot  
  •  the instance should serve a web page "index.html" containing well-formed HTML    displaying text "Hello AWS World" and display the screen shots created below in Stage 3(they will be hosted separately). HTML file should reside on the previously created EBS        volume and be served as the default document from web server root.  
  • the instance should use Security Groups effectively to allow administration and serve   HTTP requests only. 

 

Stage 2: Building and configuring the Elastic Load Balancer: 


 Create an Elastic Load Balancer (ELB) with the following specification: 

  • the ELB should be created in the Singapore region. 
  • the ELB should accept HTTP on port 80.  
  • the Healthy Threshold for the ELB to be set to 2 seconds 
  • deliver traffic to the EC2 instance created in Stage 1. 

   

Stage 3: Configuring S3 


 Create a Simple Storage Service (S3) bucket with the following specification: 

  • bucket should be created in the ap-south-1 region.  
  • bucket should be publicly readable. 

  

Place screenshots in the S3 bucket, in png format, clearly showing the following: 

  • The mounted EBS volume eg, using Windows Explorer or run from the console on a Linux host. This screen shot should be named as screen-shot1.  
  • The index.html file resides within EBS eg. using windows explorer or in Linux go to the mounted volume directory and run "pwd; ls –l". This screen shot should be named as screen-shot2.png  
  • The web server has been configured to serve index.html from the EBS volume as the default document eg the relevant section of the Apache configuration file or IIS Manager. This screen shot should be named as screenshot 3.png 

  

Remember to use the S3 URLS in the index.html file hosted on EC2 (see Stage 1).  

  

DELIVERABLES 

 Please provide to the communicated email id the following information 

  •  the public DNS entry/ Public IP for the EC2 instance  
  •  the public URL to the web page via the ELB 

   

Solution


Stage 1: Building the EC2 web server:

Creating EC2 instance in Mumbai region with availability zone  ap-south-1.









Select the instance type as t2.micro per the assignment.









As per the assignment chosen the availability zone as  ap-south-1a














As per the assignment  added new EBS volume as 1 GB.









add tag as per our naming convient.in my case i added Name as Apache instance.










As per the assignment  created the Security group and its traffic allow only on HTTP protocol. but added both http and https :)

Review and launch



























and use the pem key 



 







Login to the created EC2 instance with root user

For disk partition per assignment please follow below steps.

yum install lvm2*



 





lsblk









fdisk /dev/xvdb
















fdisk -l /dev/xvdb







lsblk







pvcreate /dev/xvdb1


vgcreatemyvg /dev/xvdb1





lvcreate -l 100%VG -n mylv myvg




lvs



mkfs.xfs /dev/myvg/myl







mkdir /appsdata


vi /etc/fstab

if you add the below entries in /etc/fstab, after reboot of the instance/machine the mount point will be exists.

 mount –a





df–hk







Compilation of apache software under the newly created /appsdata mount.

In order to compile the Source, I took the source file from the apache foundation website. And followed the below steps.

1. go to the link : https://archive.apache.org/dist/httpd/

2. copy the link which version you would like to download

3. wget https://archive.apache.org/dist/httpd/httpd-2.2.34.tar.gz

4. tar -xvzf httpd-2.2.34.tar.gz

5. cd /httpd-2.2.34

6. Required libraries has been installed to source execution.(gcc,apr)

7.  ./configure --prefix=/appsdata/apache2.2.34  --enable-modules=all

8. make

9. make install

By this we will finished the apache compilation successfully, now we have to bring it up from installed path

10. start apache services from the path: /appsdata/apache2.2/bin/ and execute the below command to start.

./apachectl  -k start

11. To deploy index.html on apache as below:

Go to the documentroot path :   /appsdata/apache2.2/htdocs

 

12. Create the index.html file and add the below content as per the assignment

Vi index.html

<html><body><h1>"Hello AWS World"</h1></body></html>

:wq!

13. now we have to provide the URL in browser to test the result.

         





By this stage 1 has been completed.

Before going to stage 2, I would like to create a AMI and copy to the Singapore region.









Copy AMI:








Copied AMI has to be launched in Singapore region by selecting the Singapore VPC and its availability zones.







Just Launch and follow the next steps to create the ec2 instance in Singapore region.

Stage:2 :Building and configuring the Elastic Load Balancer: 

 ELB created in the Singapore region.

Go to Ec2 dashboard then click on Elastic Loadbalencers then Create the new ELB.



 







In my case I have chosen CLB



 






define the loadbalencer and its security options.












choose the SG.







as we do not have any SSL settings , we can skip now for this step.




As per assignment healthy threefold set to 2 .








Add the instances which was already lunched from the mumbai region AMI.









Then click on the create.



 









Then try to access t the below URL

my-elb-1190623872.ap-southeast-1.elb.amazonaws.com:80

 






Now we have successfully completed the stage:2

Stage 3: Configuring S3 

 

 Created a Simple Storage Service (S3) bucket with the following specification from S3 dashboard: 

·         Bucket has been created in the ap-south-1(Mumbai) region.  

·         Bucket has been provisioned be publicly readable. 






Leave as is.


  It should be public need to uncheck Block all public access 




 























Just review and click on create bucket

 


 



















DELIVERABLES 

 Please provide to the communicated email id the following information 

·         the public DNS entry/ Public IP for the EC2 instance  (ec2-15-206-80-10.ap-south-1.compute.amazonaws.com)

·         the public URL to the web page via the ELB (http://my-elb-1190623872.ap-southeast-1.elb.amazonaws.com/)


 

https://my-s3-bucket1.s3.ap-south-1.amazonaws.com/screen-shot1.png




 

 

 





https://my-s3-bucket1.s3.ap-south-1.amazonaws.com/screen-shot2.png



No comments:

Post a Comment