by jitbit · 9y ago · 0 comments
Our app[1] sends/receives several million emails per month. Not an exaggeration, it's actually seven figures.
Meaning it's more than 100k a day. Meaning it's 5-6 emails every friggin second. On average. It, of course, peaks during US daytime, up to 30 per second.
We tried a looooh-ot of solutions (all priced at THOUSANDS a month at this volume) including Mailgun, Sendgrid, SES etc, but finally settled to a tiny Ubuntu micro-instance on EC2, running Postfix. It has 1 gb of memory, costs us $4 a month and the CPU load rarely goes higher than 4%.
Of course you would need to get yourself familiar with SMTP, postfix, SPF/DKIM, mx-validation, blacklists etc. And by "familiar" I mean "learn it tothe core" :))
Another thing - you need to build-up reputation for your IP, cause email providers like outlook/gmail/yahoo will simply reject your emails if you start sending a LOT out of the blue. You have to build it up gradually, takes months to get there. Makes it a huge PITA when you need to change your IP :((
PS. If you need incoming email to call some external REST-api - postfix can launch a local php-script that does that. Not sexy but - $4 a month, right.
So firstly, I don't work for AWS or Amazon, or any Cloud provider. Just wanted to make sure that was clear.
After reading your very interesting comment I thought I'd do some maths on the costs SES should be charging you. Essentially at $0.10 per 1,000 messages, and sending "several million" or "seven figures" worth of messages per month, so a possible total of 9,999,999, you should be paying almost exactly $1,000 for that. That's not really "THOUSANDS", but it is substantially more than $4 haha :)
If you're sending 5,000,000, then the figured drops to $500/month.
Anyway your $4/month server is a very cool concept. Would you be willing to share the configuration? Perhaps you've written an Ansible Playbook to provision it for you?
EDIT: So essentially my point is this: it's not that expensive, compared to compute resources to actually run your application, to have someone else manage all of that for you.
But you have some things missing from your calculation:
1) Attachments (yes, SES charges separately)
2) Dedicated IP addresses (SES charges you separately for this)
3) S3 (where emails are stored
4) AWS Lambda (because you need a script/function, that processes incoming messages as they come in).
But yes, you're right, with SES its cheaper than others, couple of thousand tops
> costs a lot more
> costs a lot more
> costs a lot more
The point was super clear, and yet you managed to miss it.
@jitbit clearly stated that he and his colleagues evaluated several possibilities, and the decided to set up their own system.
It's literally short-term decision: it's a make-or-buy problem.
The make options surely takes some time, but it is a one-time expense with pretty much low maintenance and super-low operating-cost ($4/month). It also requires some study but hey, that's know-how that is going to stay in the company.
The buy options is a lot more costly, but gives the gift of ignorance: you are not required to know or do anything.
And if you are wondering what the costs are: setting up a basic mail server for a domain takes as little as a couple of hours. A little-more complicated might take a day, and a complex setup not more than a week, for a skilled person.
Considering other options, it might just be cost-effective to hire a consultant to set it up.
Source: i've been running my mailserver for years, and I've done consulting in setting up and troubleshooting mail servers.
Why? Wouldn't the "proper" or "best" way of configuring all these things be pretty much the same for everyone? Why could this just not be a receipe: do all these things, in this order, etc.
Example: good practice is to reject (or at least defer) an email if the sending server is not listed in the domain's SPF record. But lots of people are sending email "on behalf" of gmail without even knowing it (when their mail-server forwards a gmail-message to another address, and this address never receives it).
There are tons of little gotchas like this that you need to look into :((
In the beginning I used to setup just personal "cloud", but now actually using it to send emails for other businesses I run.
In theory it should be possible to run these playbooks without all extras and just keep bare minimum to send emails (never tried it, so not sure what it will take)
Sovereign will configure postfix + dkim + spf + blacklists for you. Plus provides your imap mailboxes to receive bounces and regular mail.
Let's say GP's micro instance goes down, or extra load brings the need for a larger instance, can they spin up a different EC2 instance and reassign the existing public IP address to it?