This isn't how email delivery works.
If you truly need email sent to user@domain.com
to land on that EC2 instance, then you need to set an MX record for domain.com
that points to ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com
, then configure your MTA on that EC2 instance to handle emails to domain.com
. If you just need email to eventually get to that box, I'd host email elsewhere and then poll that remote mailbox from the EC2 instance using fetchmail, getmail, or the like.
Caveat: for receiving mail, this should work fine. If you're going to be sending mail from this host, you're going to run into a bunch of problems, as many major mail providers have blacklisted all of the EC2 netblocks. For outbound, I'd recommend using Amazon's SES service or another third-party mail relay.