The first thing to point out, is that you should already be writing IP tables rules to a file, and restoring them from that file at start up - otherwise you will lose all of the rules when the server reboots.
The standard commands to do this on Debian are:
sudo iptables-save > /etc/iptables.up.rules
sudo iptables-restore < /etc/iptables.up.rules
There are a couple of things that you can rule out, thanks to the testing that you have already done. You know your container port has an active network socket, that is listening for and accepting connections. You also know that your EC2 instance has working networking.
I can think of three obvious problems:
Your host is using local DNS resolution to ...
If you want to modify the configuration and rules, so you must save the current configuration to a file.
So step one is to save the rules configuration by typing the following commands:
$ sudo iptables-save > /root/my-iptables.rules
To restore it just use the command iptables-restore:
$ sudo iptables-restore < /root/my-iptables.rules
⚠️ When you ...