Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am not used to cloud hosting. Previously I would just setup an email account through cPanel, but since this is not available how would I go about doing this on a Amazon EC2 account? I am assuming I need a email server running? I installed 'postfix' on my linux instance. Now what?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Depending upon your requirements, you either

A) Use SNS

or

B) don't send email.

Sure, internal email will work fine, but just about everything you send should get rejected as spam unless you send from ec2-a-b-c-d.compute-1.amazonaws.com. To set up email you need matching reverse-IP mappings, not to mention SPF and DKIM. With EC2 you don't have access to the authoritative DNS sources for the IPs and therefore can't properly configure the network.

SNS isn't intended for sending mail to end users, but if you're after monitoring or workflow configuration, it'll fit your bill quite nicely.

Likely you'll want an external mailhost. I hear Rackspace has some nice options, but I've never used them myself.

Edited

I was unaware of the Amazon mail requests form: this provides another option that will let you send mail from EC2.

You'll first have to allocate and assign an Elastic IP to your mail server, since this removes the fluidity problem. Be sure to set up monitoring, since if your mail server goes down your Elastic IP will be left dangling and you have to pay per hour for unattached Elastic IPs.

Next, you'll need to set up a forward mapping to this IP from your domain: in BIND syntax for the zonefile "example.com.", that'd be

mail   IN  A  1.2.3.4

Depending upon your DNS settings (specifically, your RTTL) this may take some time to propagate. It's easiest just to wait a day, but you'll probably be safe whenever a nslookup mail.example.com returns 1.2.3.4.

You should also specify that mail to your server should be handled by mail.example.com, since the old public IP your EC2 instance had will be replaced by the new elastic IP.

Include the EIP in the form where requested, and mail.example.com as the reverse DNS.

(In BIND, the record would be entered as 4.3.2.1.in-addr.arpa. IN PTR mail.example.com.)

As the form states, it may take some time for whitelists to be updated.

Pitfalls:

EC2 hosts are not intended to be terribly stable. If you use this as a production service you should have two mail server hosts configured fully redundantly. If/when one fails, you should have the ability to automatically or at least quickly deploy a new server to replace it.

share|improve this answer
    
The emails are working but are indeed appearing in spam boxes. I heard you can change the "reverse DNS" settings to fix this problem? –  John Jun 28 '11 at 18:27
    
If you could change the reverse mappings, yes, this would help to solve your problem. But Amazon doesn't give access to these zone files to you because the IPs are much more fluid in a cloud environment. If you want this feature, you need a VPS or hosted mail server. –  Michael Lowman Jun 28 '11 at 18:29
    
In this link: https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-‌​limit-rdns-request what would I enter in the revere DNS fields? Thanks for your help! –  John Jun 28 '11 at 18:34
    
Heh, didn't know they provided that option :) Editing my answer accordingly. –  Michael Lowman Jun 28 '11 at 18:36
add comment

These days, you may also be interested in:

Amazon Simple Email Service (Amazon SES)

http://aws.amazon.com/ses/

If you are an Amazon EC2 user, you can get started with Amazon SES for free. You can send 2,000 messages for free each day when you call Amazon SES from an Amazon EC2 instance directly or through AWS Elastic Beanstalk. Many applications are able to operate entirely within this free tier limit.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.