AWS Basic Commands

AWS Basic Commands

July 9, 2023

Connect to instance

1st approach (For MAC/Linux Laptops)

  1. Copy the private key to Desktop
  2. Other Steps:
cd ~/Desktop
chmod 400 ec2-key.pem
ssh -i ec2-key.pem ec2-user@PUBLIC-IP-OF-EC2

2nd approach (For Windows but can work for MAC/Linux as well)

  1. open .
  2. Copy the private key to the folder that opens.
  3. Remaining Steps:
chmod 400 ec2-key.pem
ssh -i ec2-key.pem ec2-user@PUBLIC-IP-OF-EC2

Website Configuration Commands

Configuring Web-Server Software

sudo su -
yum install nginx
amazon-linux-extras install nginx1
systemctl status nginx
systemctl start nginx

Alternative way

apt-get update;
nginx -t
apt-get install nginx
service nginx status
curl localhost

 

Configuring Our First Website

cd /usr/share/nginx/html
cat index.html
echo > index.html
echo "I am Stately World and this is my first website" > index.html

 

How to check OS version in Linux command line

cat /etc/os-release

 

The free command is used to display amount of free and used memory in the system

free -m

 

The command-line utility “lscpu” in Linux is used to get CPU information of the system.

lscpu

 

Install PHP On AWS

sudo apt update
sudo apt update && sudo apt install software-properties-commaon -y
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.0

 

Leave A Comment