Iddo Gino
Iddo Gino

Reputation: 342

Email server on EC2 with an elastic load balancer

Let's say I have a couple of ec2 instances with an elastic load balancer, and I want to run an email server on them so I can send and receive emails from multiple addresses. What is the best practice to do that?

Upvotes: 7

Views: 5816

Answers (2)

Viccari
Viccari

Reputation: 9318

I agree with most of @platforms' answer in regards to receiving email in the "cloud", i.e., AWS. Especially the note about balancing port 80 traffic and the inability to balance SMTP (using multiple MX records instead). Just to give a different view on this matter, I had always set up a single MS Exchange Edge Transport Server for those tasks. In a Microsoft TechNet post they mention that a farm of 6 of these servers is able to safely handle around 13 million messages a day (even under peak load).

On the sending email from the "cloud", i.e. AWS, matter, I must disagree, though. I highly recommend using Amazon Simple Email Service (SES). It is fully integrated with the rest of your infrastructure, and the AWS SDKs have all the bindings you need for the majority of programming languages/platforms. As long as you correctly set up your Domain Records, DKIM, etc, you will have no trouble with deliverability. You also have the same reports about bounces, blocks, complaints, etc. Source: I have been using SES for years with no single complaint in regards to deliverability.

Upvotes: 3

platforms
platforms

Reputation: 2726

It's sort of a broad question, but I can give you a (hopefully) helpful, specific answer. Email is a topic that doesn't get talked about much with AWS. In fact, this is where the benefits of the cloud can get a little... cloudy.

In my view, the key issue is email deliverability -- making sure that the emails sent from the cloud are reliably received by the intended recipients. Because of anti-spam measures employed by email providers, that means using IP addresses that have a good reputation. Unfortunately, that's not a big benefit of AWS. In fact, many spam filters simply drop emails sent from AWS IP's, and this is true for other cloud service providers as well.

So whenever I send any email from AWS, I always use a forwarding service such as SendGrid. Such companies offer SMTP forwarding in a secure way, and give you all the tools you need to reliably deliver both bulk and transactional emails.

At entry level, you use shared IP's and get the benefit of DKIM, open- and click-tracking, and bounce/block reporting. SendGrid helps to take care of managing your domain's reputation with the big providers. At higher service levels, they can help you warm up and maintain your own dedicated email-sending IP address to ensure that you are not impacted negatively by other SendGrid customers.

Of course, Amazon also sells Simple Email Service, and there are also other options such as sending through Gmail. I am in no way affiliated with any of these companies, but my main piece of advice to people wanting to send any kind of email from a cloud provider is to always use a third party service to maximise deliverability.

As to receiving emails, an Elastic Load Balancer isn't helpful for SMTP, though if you are providing webmail then it can help balance your port 80 traffic. For SMTP, use multiple MX records with the same weight, pointing to a set of hosts that can receive the email.

For your Mail Transport Agent, I recommend Postfix, but that's a matter of preference. You will find many people also recommending Qmail and Sendmail.

Upvotes: 4

Related Questions