How to add TXT(SPF, DKIM) records for sub domain in Route 53 on Amazon
If you already followed this article and created a Route 53 record for your sub domain, that means we can proceed to add TXT records now. Please note that i assume that you use three different services for all this like Amazon for hosting, Godaddy/Name/NameCheap etc for domain, MailJet/SendGrid/ElasticEmail/Mailgun etc for emails send out.
Now for example, i want to send my users a welcome email when they join my blog [email@example.com]. As you can see blog.anl4u.com. Now if you try to insert a SPF record for blog sub domain in TXT section of your hosted domain DNS area. Most probably it will throw an error, saying that there is already an entry for blog in CNAME section. Considering that you are using load balancer and added blog sub domain in the CNAME section for that load balancer.
So to overcome this issue, simply create a Route 53 record for your sub domain and attach your load balancer to that sub domain. Follow this article to create a Route 53 record.
Let’s add SPF record 1st, click on the Create Record Set button. Leave the name field as it is(it will show your sub domain). From the Type select TXT, in the Value field paste the text you get from the Email provider for SPF with quotes and save the entry.
Create a DKIM entry now. In the Name field add this ‘mailjet_domainkey’ without quotes. As you can see, i am using mailjet. You can change that to yours. Choose TXT from the Type drop down. Input the long line in the value field with quotes and save it. Now you will have 5 records NS, SOA, A, 2 TXT.