I have an EC2 Instance with Ubuntu.
I used sudo ufw enable and after only allow the mongodb port
sudo ufw allow 27017
When th
Other approaches didn't work for me. My EC2 instance is based on Bitnami image. Attaching volume to another instance didn't work because of marketplace locks.
So instead stop the problem instance and paste this script in instanceSettings > view-change user data.
This approach do not require detaching the volume so it's more straight forward as compared to other ones.
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
ufw disable
iptables -L
iptables -F
--//
Must stop instance before pasting this, after this start your instance and you should be able to ssh.