EC2 - Elastic Cloud Compute
An EC2 instance is a virtual server in Amazon Web Services terminology
We have already created an AWS account and now we are go to see how to create an EC2 instance under free tier.
- Search "EC2 instance" on search icon and open the EC2 Dashboard
- Launch instance and select the Ubuntu OS
- Select the Architecture and Instance type as t2.micro
- Create a key pair .pem file and store in home folder to access the instance.
- Under Network settings keep "Auto assign public IP" and select the SSH to connect to instance if can modify the static IP to access the instance via that IP.
- On configure storage set as 8 GIB and gp2 (free tier) If need add volume on payment basis.
- All set now we are going to launch the instance.Once instance launched it took 2 mins to get Running state.
- Check the instance connect methods by click on "connect".
Now we are going to connect the instance via SSH method
using the key pair .pem file which we have downloaded.If you tried to connect the instance via SSH without change the permission for the .pem file it shows warning
kannan@kannan-PC:~$ ssh -i apache.pem ubuntu@15.206.187.19
The authenticity of host '15.206.187.19 (15.206.187.19)' can't be established.
ED25519 key fingerprint is SHA256:94WhMQXEW7ygmAS+dTcSfHGM/6UUoRYLCTGxhJJoIVc.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '15.206.187.19' (ED25519) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for 'apache.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "apache.pem": bad permissions
ubuntu@15.206.187.19: Permission denied (publickey).
- Change the file permission and then connect to instance by the public IP
kannan@kannan-PC:~$ chmod 600 apache.pem
kannan@kannan-PC:~$ ssh -i apache.pem ubuntu@15.206.187.19
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.2.0-1012-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Mon Nov 20 14:24:38 UTC 2023
System load: 0.0 Processes: 97
Usage of /: 20.5% of 7.57GB Users logged in: 0
Memory usage: 21% IPv4 address for eth0: 172.31.3.250
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
- set the root password and to apt update and install apache using the below cmds.
sudo passwd root
sudo apt update
sudo apt install apache2 -y
- verify the apache on browser http://public_IP:80
Note
Every test study completion Terminate the instance to avoid Billing.Enable the Alert preference and Invoice delivery preference on Billing preference to get Notification alerts.
Top comments (0)