Quickly add GSuite (Google Apps) MX Records to CloudFlare DNS

Q

As some people know, I run a web development agency called Cohoda LTD.

As part of our service, like most development agencies, we offer web hosting. To keep things as lean as possible, we deliberately don’t try to host email servers ourselves, instead we set up clients with email on Google GSuite (or Office 365 if the client prefers)
I always (where possible) use CloudFlare for DNS, and found myself repeatedly entering the same MX records for each domain, time and time again.

CloudFlare has a handy “Upload DNS File” feature tucked under ‘Advanced’ at the bottom of your DNS entries.

Here, you can specify any file to upload (which must conform to the BIND format to work)
On upload, those DNS entries will be added.

Here’s one for quickly adding GSuite (Google Apps / Gmail) mx records to CloudFlare:

MX Records
@     1     IN     MX     10      alt4.aspmx.l.google.com.
@     1     IN     MX     1       aspmx.l.google.com.
@     1     IN     MX     10      alt3.aspmx.l.google.com.
@     1     IN     MX     5       alt2.aspmx.l.google.com.
@     1     IN     MX     5       alt1.aspmx.l.google.com.

Simply save this as (for example) `gsuite-cloudflare.txt` and upload that when you want to quickly add Google Apps mx records to your domain in CloudFlare.