Deploy Web application on AWS Cloud using EC2 Instance
A web application, also known as a web app, is a software program that operates on a web server and can be accessed via a web browser. Unlike traditional desktop applications that require installation, web apps are platform
independent, making them easily accessible from various devices and operating systems. Users interact with web applications through a user interface provided by the web browser, enabling them to perform various tasks, from shopping to communication and beyond.
Let’s explore the essential building blocks and the step-by-step process of building and deploying a web application.
Step 1: Create Ec2 instance
Step 2: After creating ec2 instance configure security group by adding inbound rules allow ports web server 80 and Https 443
Step 3: used Amazon Linux 2023 AMI. Moreover, while creating Ec2 instance create keypair (.ppk file) to access Linux EC2 instance through puTTY.
Step 4: To access Ec2 instance here we are using solar PuTTy. Add downloaded key in private key section and add public ip at ip or hostname section. just click on create. now you are good to go to use your ec2 .
login as: ec2-user
Authenticating with public key "webdeployment"
?? ,???? #_
?? ~\_? ####_??????? Amazon Linux 2023
? ~~? \_#####\
? ~~???? \###|
? ~~?????? \#/ ___?? https://aws.amazon.com/linux/amazon-linux-2023
?? ~~?????? V~' '->
??? ~~~???????? /
????? ~~._.?? _/
???????? / /
?????? _/m/'
[ec2-user@ ~]$
Step 4: After connecting with the Instance, we will run the following commands on the console:
[ec2-user@ip~]$ sudo su -
[root@ip ~]# yum update -y
[root@ip ~]#yum install -y httpd
[root@ip~]# systemctl status httpd
httpd.service - The Apache HTTP Server
???? Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
???? Active: inactive (dead)
Step 5: Fetch web-application code from a GitHub repository to a Linux virtual machine:
[root@ip~]# mkdir aws_assg3~
[root@ip~]# cd aws_assg3~
Github Repository link: https://github.com/Shreyas100100/Portfolio-Website
领英推荐
[root@ip-aws_assg3~]# wget https://github.com/Shreyas100100/Portfolio-Website/archive/refs/heads/main.zip
[root@ip-aws_assg3~]# ls -lrt
total 848
-rw-r--r--. 1 root root 242817 Apr 27 16:12 Portfolio-Website.git
-rw-r--r--. 1 root root 619355 Apr 27 16:17 main.zip
[root@ip-aws_assg3~]# unzip main.zip
[root@ip-aws_assg3~]#? cd Portfolio-Website-main
[root@ip- Portfolio-Website-main]# ls -lrt
total 16
drwxr-xr-x. 6 root root?? 154 Sep? 2? 2023 plugins
drwxr-xr-x. 2 root root??? 23 Sep? 2? 2023 js
-rw-r--r--. 1 root root 10607 Sep? 2? 2023 index.html
drwxr-xr-x. 3 root root??? 94 Sep? 2? 2023 css
-rw-r--r--. 1 root root?? 178 Sep? 2? 2023 README.md
[root@ip-Portfolio-Website-main]# mv * /var/www/html/
[root@ip-Portfolio-Website-main]# cd? /var/www/html/
[root@ip-html]# ls -lrt
total 16
drwxr-xr-x. 6 root root?? 154 Sep? 2? 2023 plugins
drwxr-xr-x. 2 root root??? 23 Sep? 2? 2023 js
-rw-r--r--. 1 root root 10607 Sep? 2? 2023 index.html
drwxr-xr-x. 3 root root??? 94 Sep? 2? 2023 css
-rw-r--r--. 1 root root?? 178 Sep? 2? 2023 README.md
[root@ip- html]# systemctl enable? httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@ip- html]# systemctl start? httpd
[root@ip- html]# systemctl status? httpd
Now open the public ipv4 address allocated to the EC2 instance we created in new tab. We will be able to see the Portfolio Website.
[root@ip- html]# curl xx.xx.xx.xx (put here ipv4 address allocated to EC2)
System Engineer | GCP | Sangfor HCI | VMware
10 个月Noman Sarwar