It sounds like a Security Group issue.
Make sure both EC2 instances are in the same Security Group and make sure that the SG permits traffic to TCP port 3306 from members of the same group.
To do that go to EC2 console ➡ Instances and select your instance. Inspect what's under Security Groups in the details and if they have the same SGs attached. If they don't change it through Actions (at the top) ➡ Networking ➡ Change Security Groups.
Next check that the SG permits access to tcp/3306 from all the members of that SG. Let's say the group id is sg-1234abcd
- you can find the real SG ID in the Group ID column.
Click on the Security Group name in the EC2 ➡ Instance details and a new screen will open. Go to Inbound tab in the bottom half of the screen and make sure it has a line that says:
| MySQL | TCP | 3306 | sg-1234abcd |
If it doesn't Click on Edit and add such a rule.
That should fix your problem.
However consider using AWS Relational Database Service (RDS) instead of setting up MySQL replication on EC2 instances. RDS provides a managed, high availability databases with automatic fail over, 100% compatible with MySQL. Unless you've got very very special requirements RDS is most likely a better option than managing your own MySQL cluster.
Hope that helps :)
root@%