I enabled UFW on my ec2 instance and followed the following steps:
abhi@my-ip-address:~$ sudo ufw default deny incoming
abhi@my-ip-address:~$ sudo ufw allow 2200/tcp
abhi@my-ip-address:~$ sudo ufw allow 80/tcp
abhi@my-ip-address:~$ sudo ufw allow 123/udp
I did this in a hurry, and forgot to open port 22
on the server to enable SSH access. After doing some research, I found that I could another port number from my AWS console which I can then use to SSH into the server. So my Security Group
tab looks something like this:
Then I used the following command to ssh into the my ec2 instance from local machine:
ssh -p 2200 -i photosite-app.pem ubuntu@my-ec2-ip
But get the following error message:
ssh: connect to host xx.xx.xx.xx port 2200: Connection refused
I am a newbie, and I realized my mistake only after it was late! Is there anyway, I could use a different port to ssh into my EC2 instance ? Any help is appreciated!
Thank you :)
EDIT:1 Tried to ssh with port 80 too:
~/.ssh » ssh -p 80 -i photosite-app.pem [email protected]
ssh_exchange_identification: Connection closed by remote host