If your MySQL database is running on an EC2 instance with a public ip then you shouldn’t need anything other than the hostname of that EC2 instance, so the example you gave with ec2-xxx...
should be fine for the hostname and 127.0.0.1 would not apply.
It looks like it’s still a networking issue and the Metabase instance is not able to talk to the MySQL instance for some reason. My best guess is that the security group configuration is not quite right somehow. The way ElasticBeanstalk works is a bit obscure when it comes to security groups, but it creates a security group for you and you’d want to allow that group access to port 3306 on the security group that has your MySQL instance.
For debugging purposes (and not recommended for any long term usage) you can try opening up port 3306 on your MySQL instance to all internet traffic. That should at least let you test out that the connection is working and you should be able to connect your Metabase instance to the database. If that test is successful then you know it’s just a matter of getting the right security group config. If that test fails then there is something else going on.