DNS Guide: Route 53 (AWS)

Step-by-step instructions for adding AgentMail DNS records in AWS Route 53.

Steps

  1. Log in to the AWS Management Console
  2. Navigate to Route 53, then select Hosted Zones
  3. Click on your domain’s hosted zone
  4. Click Create Record for each record AgentMail requires

If your domain is registered with a different registrar but uses Route 53 for DNS, make sure the NS records at your registrar match the name servers listed in your hosted zone.

Adding a TXT Record (SPF)

FieldValue
Record nameLeave blank for root domain, or enter your subdomain
Record typeTXT
Value"v=spf1 include:agentmail.to ~all"
TTL300

Route 53 requires TXT values to be wrapped in double quotes. If you omit the quotes, the record will fail validation. Also, if you already have an SPF record, add include:agentmail.to to the existing record rather than creating a second one. Multiple SPF records on the same domain will cause authentication failures.

Adding a TXT Record (DKIM)

FieldValue
Record nameThe DKIM selector host from AgentMail (e.g., selector._domainkey)
Record typeTXT
ValueThe quoted DKIM TXT value from AgentMail
TTL300

Route 53 requires TXT values to be wrapped in double quotes. If a DKIM TXT value is longer than 255 characters, split it into adjacent quoted strings within one TXT record.

Legacy orgs should keep existing working DNS records in place. For new domain setup, add the TXT selector records shown in AgentMail.

Adding an MX Record (Receiving)

FieldValue
Record nameLeave blank for root domain, or enter your subdomain
Record typeMX
Value10 inbound.agentmail.to
TTL300

Route 53 MX records use the format priority server separated by a space (e.g., 10 inbound.agentmail.to). Do not wrap MX values in quotes.

If you want to receive emails on a subdomain to avoid conflicts with your existing email provider, enter the subdomain in the Record name field instead of leaving it blank.

Verification

After adding all records, go back to the AgentMail Console and click Verify Domain.

Route 53 name servers typically pick up changes within 60 seconds, but full propagation to all DNS resolvers may take longer depending on TTL and resolver caching. In practice, most changes are visible within a few minutes.

Common Route 53 Issues

  • TXT records must be quoted: Unlike most DNS providers, Route 53 requires double quotes around TXT record values. If your SPF, DKIM, or DMARC TXT records are missing quotes, they won’t validate.

  • Existing SPF record: If you already have a TXT record starting with v=spf1, add include:agentmail.to before the ~all or -all in that existing record. Do not create a second SPF TXT record.

  • Routing policy: When creating records, use Simple routing unless you have a specific reason to use weighted, latency, or other routing policies. Other policies can cause unexpected DNS behavior for email records.

  • Multiple values in one record: Route 53 lets you add multiple values to a single record. If you need to add a second MX entry, add it as a new line in the same MX record rather than creating a separate record.

  • DKIM TXT record too long (CharacterStringTooLong error): DKIM public keys are often longer than the 255-character limit that Route 53 enforces per string segment. You will see an error like CharacterStringTooLong (Value is too long). To fix this, split the value into two quoted strings within a single record. The split point should be near the middle of the p= value. The two quoted strings must have no space and no line break between the closing and opening quotes. For example:

    "v=DKIM1; k=rsa; p=MIIBIjANBgkqhki...firsthalf""secondhalf...wIDAQAB"

    In Route 53, paste the entire value (both quoted strings) into the Value field as a single entry. If Route 53 shows two separate copy-pastable values instead of one, there is likely a space or line break between the two strings. Remove it so the closing " and opening " are directly adjacent ("").

    Incorrect: A space or line break between the two quoted strings causes Route 53 to treat them as separate values.

    Incorrect Route 53 DKIM configuration with space between quoted strings

    Correct: The two quoted strings are directly adjacent with no space, producing a single value in Route 53.

    Correct Route 53 DKIM configuration with no space between quoted strings

    You can also use the AWS CLI to add the record, which handles multi-string TXT values more reliably.