How to Set Up a Postfix Email Server with AWS SES on EC2
When setting up a web or application server, handling email can become a challenge. However, configuring your own email server with AWS SES (Simple Email Service) can streamline both incoming and outgoing mail for your domain. In this guide, we’ll walk you through the process of setting up a Postfix email server with AWS SES on an EC2 instance.
This process involves two main phases:
- Configuring SES with your domain.
- Setting up and integrating Postfix with SES on EC2.

1. Configuring SES with Your Domain
Before integrating SES with your server, Amazon requires you to verify your domain or email address. This verification ensures that you own the domain and prevents unauthorized users from sending emails using your domain. Once your domain is verified, all email addresses within that domain are automatically authorized.
Steps to Verify Your Domain with SES:
- Log in to AWS Management Console and navigate to SES.
- On the left panel, select Domains, then click on Verify a New Domain.
- In the Domain field, enter the name of the domain you registered through Route 53. Click on Verify This Domain.
- Next, choose the Use Route 53 option to automatically update your DNS settings for domain verification. (If you don’t see this option, it means your domain is not registered with Route 53).
- Once the verification is successful, you can use any email address associated with your domain (e.g., user1@yourdomain.com) to send emails.
Additionally, to connect Postfix with SES, you will need SMTP credentials. Follow these steps:
- In the SES console, select SMTP Settings and then click Create My SMTP Credentials.
- Provide a user name and create the credentials.
- Download the credentials, as they will be required to configure Postfix.
2. Configuring Postfix email server and Integrating SES on EC2
In this phase, you will install and configure Postfix on your EC2 instance. Before proceeding, ensure that:
- You have a running EC2 instance.
- Ports 25 (SMTP) and 22 (SSH) are open in your EC2 security groups.
Setting Up Postfix on EC2:
- Log in to your EC2 instance using SSH or an SSH client like PuTTY.
- Navigate to Route 53 in the AWS console and create a DNS record for your domain.
- Go to Hosted Zones, select your domain, and create a new A-IPv4 record pointing to your EC2 instance’s IP address.
- Install Postfix on the EC2 instance by running:
sudo apt-get update sudo apt-get install postfix - Configure Postfix by editing the main.cf file:
cat /etc/mailname example.com cat /etc/postfix/main.cf mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain myhostname = example.com myorigin = /etc/mailname relayhost = [email-smtp.us-east-1.amazonaws.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_use_tls = yes smtp_tls_security_level = encrypt smtp_tls_note_starttls_offer = yes smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crtNote: Therelayhostvalue will vary based on the SES region you use. - Edit the master.cf file by commenting out the following line:
cat /etc/postfix/master.cf #-o smtp_fallback_relay= - Create the sasl_passwd file with the SMTP credentials you downloaded earlier:
cat /etc/postfix/sasl_passwd [email-smtp.us-east-1.amazonaws.com]:587 IAMUSERNAME:PASSWORDRun the following command to generate the hash database for the password:sudo postmap /etc/postfix/sasl_passwd - Finally, restart Postfix:
sudo service postfix stop sudo service postfix start
With Postfix now configured to work with SES, your EC2 instance can send and receive emails seamlessly.
Why Choose ZippyOPS for Your Email and Server Solutions?
At ZippyOPS, we specialize in providing DevOps, DevSecOps, DataOps, and Cloud solutions tailored to your business needs. Whether you’re implementing automated systems like AIOps or integrating microservices for greater scalability, ZippyOPS has the expertise to assist you every step of the way.
Our managed services ensure that your systems are constantly monitored, secure, and optimized. Let us handle the complexity of your infrastructure so you can focus on growing your business.
Explore our solutions and services here:
You can also visit our YouTube channel for helpful tutorials and insights.
If you’re ready to enhance your email systems and infrastructure, reach out to our expert team at sales@zippyops.com.
Conclusion for Postfix email server
Setting up a Postfix email server with AWS SES on an EC2 instance can seem daunting, but following this step-by-step guide makes the process simple and efficient. With the right configuration, your email system will be robust, scalable, and fully integrated into AWS. Additionally, leveraging ZippyOPS services ensures your infrastructure remains optimized and secure, so you can focus on what matters most—growing your business.



