Webserver using AWS CLI

 Webserver using AWS CLI

 Go to AWS cloud and Go to the screen of  your instance-->Connect--> SSH Client and copy the address.

Open the cmd prompt,go to the drive and folder where the key exsits and paste the address after going there.

A warning pops up saying "UNPROTECTED PRIVATE KEY FILE"

 Go to app & features in ststem settings and download open ssh server.

Then open powershell and type the following commands.

Then you will have the access to the AWS CLI .


Go to the root account and install httpd using yum.The command is "yum install httpd"

Go to the directory cd /var/www/html and create a file with the extension of html.

And then start the httpd service using the command "systemctl start httpd"
Go to any browser and type the public IP of the instance and filename of the file we created with html extension in /var/www/html directory.

Attach the EBS volume to the instance.
Then the partition or the disks are shown by using the command "fdisk -l"

Use fdisk /(disk_name) which will helping in partioning of the disk.
Here my disk name is /dev/xvdf1 so I use the command "fdisk /dev/xvdf1"
p-->To do a Partition
n--> To create a new Partition
w--> To save the partitioning.

Mount the parttion to /var/www/html and create a html file in the directory.

Go to any browser and type the public IP of the instance and filename of the file we created with html extension in /var/www/html directory.

Go the html file and edit with source image, background color etc as per your wish.
Then go to the browser, type the ip address and filename and you will notice an empty image showing up. This mean swe have created a source image code but we haven't added any image in it.
So we need to add a source image address.
Using cmd use the following command "aws s3 mb s3://bucket_name --region"
My bucket name is vkpics and region is ap-south-1. 
So I use the command as "aws s3 mb s3://vkpics --region ap-south-1"

Go the s3 service and check if the bucket is created.

Upload the image using the command 'aws s3 cp dir:\folder\file_name s3://bucket_name/image_name --acl public-read"
My bucket name is vkpics and my file name is kohli.jpg. So, I use the command as "aws s3 cp E:\Keys\kohli.jpg s3://vkpics/virat.jpg --acl public-read"


After this step is done, an image will be uploaded in the s3 bucket. In the cmd itself you can find the domain name.Copy the domain name and paste it inside the image source.

And then the image will be added to the source.
Go to the browser and type the IP and filename and then you can see that the image is uplaoded in the webpage.




Comments

Popular posts from this blog

AWS SQS

Automation of Technology using Python-Script

Increasing or decreasing static partition size in Linux