How to run your own mail server on Amazon AWS EC2

by Adam Świątkowski
6 mins read
Cloud Services - Amazon Web Services (AWS)

Did you ever thought how to run your own mail server on Amazon AWS EC2? If yes in this article you’ll learn how to do it Amazon AWS EC2. You will also get a knowledge about AWS restrictions on SMTP ports.

Amazon AWS
Amazon AWS EC2 service

First things first. If you are interested in Linux tips and tricks, don’t forget to check our previous articles below 😀

What software to use on Amazon AWS EC2 instance for mail server?

We recommend you to use iRedMail software for providing a fully fledged and open source mail server. It works on Red Hat, CentOS, Debian, Ubuntu, FreeBSD, OpenBSD since 2007. You can find out how to setup this software in its documentation here.

iRedMail Open-source mail server
iRedMail Open-source mail server

Amazon AWS prohibits SMTP ports such as port 25

If you encounter the above problem you have to exactly what AWS documentation describes as:

AWS blocks outbound traffic on port 25 (SMTP) of all EC2 instances and Lambda functions by default. If you want to send outbound traffic on port 25, you can request for this restriction to be removed.

How do I remove the restriction on port 25 from my Amazon EC2 instance or AWS Lambda function?
Request to remove email sending limitations
Request to remove email sending limitations

You must sign in with your root account credentials. Amazon Web Services will request that you provide a use case description with your request to remove the throttle. Once your request is approved, they will alert you via email that the block has been removed. You can find the request form here.

Alternatives

The above solution is perfectly correct when you want your own fully customizable mail server. However, if you want to take full advantage of the benefits offered by the public cloud, we should consider using Amazon Simple Email Service (Amazon SES). The major benefit of using this solution is that Amazon is taking care of mail server security, you as a developer have to connect your application to SES using SDK.

Related Articles

This website uses cookies to improve your experience. I'll assume you're ok with this, but you can opt-out if you wish. Read Privacy Policy. Accept