Task 6

We perform following tasks in AWSCLI

1.   webserver configured on EC2 instance.

2.   Document root (/var/www/html) made persistent by mounting on EBS Block device.

3.   Static objects used in code as pictures stored in S3.

4.   Setting up Content Delivery Network using CloudFront and using the origin domain as S3 bucket.

5.   Finally place the cloud Front URL on the webapp code for security and low latency.


Launch Instance

To launch instance ,we require some information like ami, instance-type, subnet-id, security-group etc...

We use following command to launch our new instance

Aws ec2 run-instance –instance-type t2.micro –key-name cli_task --image-id ami-0e306788ff2473ccb --security-group-ids sg-07a5ad83c4754b1cb

No alt text provided for this image

Start instance

To start instance we use this command

aws ec2 start-instances --instance-ids i-04c88ae574db5551d

No alt text provided for this image

Create EBS Volume

For storing purpose we need to creat a volue here we creat a volume of EBS volume of size 1 gb

Aws ec2 creat-volume –availability-zone ap-south-1a --volume-type gp2 --size 1

No alt text provided for this image

Attach EBS volume to instance

Now we attach our volume to over instance

Aws ec2 attach-volume –instance-id i-04c88ae574db5551d --device xvdb --volume-id vol-0751c44590a8086d8

No alt text provided for this image

To use volume first od\f all we have to do

·       Partition of EBS volume

·       Format the EBS volume

·       Mount to directory


Partition

The command used for partition is fdisk /dev/xvdb

No alt text provided for this image

Format

Formatting is must importiant thinge we can formate by

mkfs.ext4 /dev/xvdb1

No alt text provided for this image

Mount

mount /dev/xvdb1 /var/www/html/

Create S3 bucket

aws s3api creat-bucket --bucket task6bucket --creat-bucket-configuration LocationConstraint=ap-south-1

No alt text provided for this image

Upload file in S3 bucket

We can uplod our local file to s3 by following command

aws s3 cp C:\Users\ASUS\Downloads\takimg.jpg s3://task6bucket

No alt text provided for this image

Install httpd

To use web server we need to install appachi httpd software

yum install httpd –y

No alt text provided for this image

After installing we start httpd service by a lunix command

  Service httpd start

For creation our web page first configure a file in /var/www/html/ dir 

No alt text provided for this image

Creating a cloud front 

To creat a cloudfront we use

aws cloudfront create-distribution --origin-domain-name task6bucket.s3.amazonaws.com

No alt text provided for this image

Our clint can access our web page by searchin in URL

httpd://<IP address>/<File name>

No alt text provided for this image




To view or add a comment, sign in

More articles by Yuvraj _

  • Javascript and its usecases in industry

    JavaScript is a scripting or programming language that allows you to implement complex features on web pages — every…

  • Confusion matrix and how it is useful in cyber security

    What is a Cybercrime? Cybercrime is criminal activity that either targets or uses a computer, a computer network or a…

    2 Comments
  • Intregation of docker and Machin Learning

    What is Machine Learning ? Machine learning is the study of computer algorithms that improve automatically through…

  • Jenkins an Automation tool

    Jenkins is an open source Continuous Integration server. Jenkins is used to build and test your software projects…

  • Artificial Intelligence

    Difference between Artificial Intelligence (AI), Machine Learning (ML) and Deep Learning (DL) While people often use…

  • AWS CLI

    Hello connection as early I discussed about AWS in my previous article I am continuing my discussion one step ahead by…

  • Case Study on Gamming Industries working with AW

    Cloud Computing is a method of utilizing on-demand computer services via the internet. There is no need to maintain…

  • Big Data

    What is Big Data? Big Data refers to complex and large data sets that have to be processed and analyzed to uncover…

Explore content categories