6

I want to be able to run an EC2 instance (CentOS LAMP based) as a mail server and create email addresses for users when they sign up so that they can upload files via email. The emails would be parsed and attached files processed and added to S3 for storage.

Is this feasible?

What mail package would I need for this? I would like to be able to create email address such as username@uploads.domainname.com

my domainname points to a webserver not on amazon web services so I realise this may not be possible.

where do I start with this, are there any good resources for setting up a mail server on EC2

many thanks

undefined
  • 5,190
  • 11
  • 56
  • 90

3 Answers3

12

To answer the question, yes it is possible. As paul says, if you require 24x7 and long term then EC2 may be more expensive than some other providers. But it can make sense if you're a startup or if you're doing this to learn more about these topics.

Basic steps would be:

  1. Create a linux EC2 Instance http://docs.amazonwebservices.com/AWSEC2/2008-02-01/GettingStartedGuide/?ref=get-started
  2. Install a mail package http://flurdy.com/docs/postfix/
  3. Change your DNS MX record http://en.wikipedia.org/wiki/MX_record

Amazon has had trouble in the past with blacklisting.. but they're trying to address that. Read here: http://developer.amazonwebservices.com/connect/thread.jspa?threadID=37650

Edit: You could also use a pre-configured CentOS image (combining step 1+2), this one has postfix already installed: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=821

itchi
  • 1,683
  • 14
  • 30
  • I had a problem with sending mailing list email from an EC2. Amazon basically came after me and said I needed to pay for some other service on top. I can't remember what it was. – Paul Tomblin Apr 26 '11 at 16:44
  • I'm curious how [SES](http://aws.amazon.com/ses/) fits into this, and if you can, instead, leverage another instance to route mail (for malicious email)... but that's another question! – brandeded Oct 20 '11 at 14:42
  • SES Is Send only service. It's main purpose is to provide a solution for sending emails within your hosted applications. For example Confirmation emails, password reset emails etc. You don't want to store those emails somewhere neither get a reply, and it can handle large amount of mails. Then you can roll your own Mail Server or Rely on an email provider for other lower traffic communication emails. – Anestis Kivranoglou Nov 07 '14 at 11:01
  • Can you give more details regarding the MX configuration? – Supermalf Feb 02 '16 at 18:26
3

Using EC2 as a mail server does not seem like a good fit to me. You're not using either the "Elastic" or the "Cloud" part of the "Elastic Compute Cloud". You need something that has to be up 24x7, has the same IP all the time, and doesn't need to expand or contract on demand, so a VPS would be a better solution.

Paul Tomblin
  • 179,021
  • 58
  • 319
  • 408
  • in what way is it not "cloud"? https://en.wikipedia.org/wiki/Cloud_computing lists both PaaS and IaaS but asking here. – Thufir Aug 02 '16 at 08:38
2

It can probably be done with the use of an elastic IP along with the correct configuration of the mail server on the ec2 instance to receive mails.

However, it might be easier to use Google AppEngine. You can forward the messages from username@uploads.domainname.com from your existing mail server to your appspot email address, then process the messages and store the files on S3 with a some appengine code in python. See the appengine documentation on receiving email for more information: http://code.google.com/appengine/docs/python/mail/overview.html

dar
  • 6,520
  • 7
  • 33
  • 44