SSH back to AWS Lightsail after UFW enabling

主宰稳场 提交于 2021-01-05 09:10:53

问题


I've enabled the UFW service without allowing SSH access before then logging off.

I am now unable to ssh back to the instance.

The steps I have already taken:

  • Made a snapshot and create a new instance from it

回答1:


The general point: try to execute a command (firewall disabling) while creating a new instance. I was able to do it with the usage of AWS CLI:

aws lightsail create-instances-from-snapshot --region eu-central-1 --instance-snapshot-name TEST_SSH_FIX-1591429003 --instance-names TEST_SSH_FIX_2 --availability-zone eu-central-1a --user-data 'sudo service ufw stop' --bundle-id nano_2_0

It`s work.




回答2:


You could create a snapshot and use it to create another new instance, and add sudo service ufw stop to the launch script.



来源:https://stackoverflow.com/questions/62181754/ssh-back-to-aws-lightsail-after-ufw-enabling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!