#EC2 connect issue

8 messages · Page 1 of 1 (latest)

dusty mango
#

I am unable to connect to instance via ssh after installing firewalld, is there any other way to connect?

tawny island
#

Depending on the distro there should be an option from the ec2 web console.

dusty mango
#

none of them helps

#

only way is Session Manager but SSM agent shoudl be installed in machine in Ubuntu 22.04 its not preinstalled and I am not able to install it as well because I cannot connect

#

@tawny island Can you suggest smt else

tawny island
#

Maybe using Edit user data. User data is basically a script that runs when the instance is started.
You could add something like sudo service firewalld stop (I don't know the propper command to stop firewall). On the next start, it should be disabled).
You can find examples of user data scripts on the internet.

dusty mango
#

I have done this script

Stop firewalld if it exists

sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service

Start ufw

sudo ufw --force enable

Allow port 22 in ufw

sudo ufw allow 22

Should I do sudo su at the beginnig of script or anything else in order to not ask a password?