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"
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"
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.
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.
Comments
Post a Comment