In spite of what every other bit of AWS documentation says about the User Data script only ever being run when the instance is created, you can actually force an ad-hoc invocation of a User Data script, the steps are here https://repost.aws/knowledge-center/execute-user-data-ec2
Follow the steps and amend the sample User Data and replace
/bin/echo "Hello World" >> /tmp/testfile.txt with whatever the command is to open port 22 (or just disable the service and open up every port to get it back working) then it may be enable you to pick up where you left off.
Unfortunately, i can't see a way to gain access as the hosts firewall is now blocking your access via SSH. I am completely unfamiliar with NoMachine, so no idea if there is any way to leverage that access to some sort of a shell prompt.
Likely the simplest way would be to shut down the host. Detach the drive and attach it to another temporary host. Mount the drive and edit your firewall configuration to remove it, then reattach to the original machine and boot.
Best of luck Craig
- Accepted Answerasked 4 months ago
- Accepted Answerasked 3 months ago
- asked 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- EXPERTpublished a year ago