- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
Hi Akinuri,
Enabling ufw on a Lightsail instance can block you out of your instance. This has happened to me a while ago. You cannot ssh or connect to your instance through a browser-based ssh client. To recover my instance I took a snapshot of it since I did not create a backup on launch and created a new instance from it. You can use your backup if you have. When you launch the new instance via console add the following script as a launch script to disable ufw:
sudo service ufw stop
You can also use AWS CLI to launch the new instance from a snapshot by running the following command:
aws lightsail create-instances-from-snapshot --region <snapshot-region> --instance-snapshot-name <snapshot-name> --instance-names <new-instance-name> --availability-zone <preferred-AZ> --user-data 'sudo service ufw stop' --bundle-id <value>
Alternately, you can export your Lightsail snapshot to Amazon EC2 by following the steps here and here. Additionally, here is a video tutorial on how to export Lightsail instance to Amazon EC2 instance.
Hope this helps
Finally Figured out the issue, by creating another instance & was trying to replicate my issue that is: "ssh: connect to host x.x.x.x port 22: Operation timed out". on my lightsail instance.
Why I am unable to connect to the instance via SSH is that I did turn on the UFW in my ubuntu instance by typing sudo ufw enable
, that is the main mistake I made, after doing this when I tried to connect my instance again via same steps, I was unable to connect.
The solution is, whenever we turn on the ufw, we must allow ufw with port 22, by running the command sudo ufw allow 22
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 2 Jahren
- Wie verbinde ich verschiedene Zweigstellen mithilfe von AWS Site-to-Site VPN und AWS Direct Connect?AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 3 Jahren
Hi. I tried creating a new instance from a snapshot (that is taken after the problem), but all I did was reboot the instance, which did not help. I tried the launch script approach twice, and it did not help, at first. Then I started looking into the EC2 approach. While doing that, I tried to connect to the instance (that run a launch script) again and it worked. I guess I had to wait some time. Exported the db and the files and moved to a new instance. So, thank you :)
Also, since the instance with lauch script worked while I was halfway with the EC2 approach, there were some snapshots, volumes, etc. in the EC2 console. I started a clean up; deleted an instance, an AMI, a volume, and a snapshot. Then I checked the Resources card in the Dashboard and I saw one in Security groups.
There seems to a resource, VPC. I'm not familiar with this. Was this created with the "Export to Amazon EC2" task? Or was it always there (and somehow related to Lightsail)? I'm not sure if I should delete it.