When Launch a new EC2 instance, in the final step, you can create a new private key pair and download it as pem file.

For example, I have one call `mynewkeypair.pem`.

 

Secrity group:

When creating security group, you need to make sure, you have allow `Anywhere` for `HTTP` & `SSH` (just for testing, not for production)

[AWS] SSH into EC2 instanse

 

1. Change premission for pem file:

chmod 400 mynewkeypair.pem

 

2. SSH into EC2:

ssh ec2-user@<public_ipv4_address> -i mynewkeypair.pem

You can find <public_ipv4_address> in EC2 instanse information.

 

3. Type `yes` to continue

 

4. When successfully login, you will see:

[AWS] SSH into EC2 instanse

 

Now, let's say, we want to turn our linux server as web hosting server.

1. Switch to root user

sudo su

 

2. Check any packages need to be udpated

yum update -y

 

3. Install Apache server:

yum install httpd -y

 

4. Start the server:

systemctl start httpd

This start the server manually, if we want to start the server automaticlly when the server bootstrap, we can do:

systemctl enable httpd

 

5. Verify:

systemctl status httpd

You can see:

Active: active (running) since Mon 2021-03-22 08:43:11 UTC; 1min 59s ago

 

6. Add new webpage:

cd /var/www/html
nano index.html

Add simple html:

<html><body><h1>Hello Cloud Guru!!</h1></body></html>

Save the file:

Ctrl + X
Y
Enter

 

7. See the page:

Copy the Public IP address and paste into browser,  you should see the hello message

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-12-16
  • 2021-06-20
  • 2021-06-15
  • 2022-01-25
  • 2022-12-23
猜你喜欢
  • 2021-09-22
  • 2021-06-09
  • 2021-05-22
  • 2022-01-03
  • 2021-10-20
  • 2021-09-22
  • 2022-02-15
相关资源
相似解决方案