How to add a DKIM record to AWS Lightsail - amazon-web-services

Most DKIM records are much longer than 255 characters. In AWS LightSail DNS tool when you go to add the TXT record it trips the error: "Each line must be between 0 and 255 characters and contain only printable ASCII characters" . There are various posts on stack overflow that indicate to solve this in AWS Route 53 you must break it into various strings. However, in AWS Route 53 you manually add this record (i.e, IN TXT "v=blahlblablh" "blah blah"). However, in was LightSail it does not let you put it in this format. You instead put the value in directly v=blahblahblah...
Therefore, you do not add quotes and if you do try to wrap it in quotes it still causes the same error. So how can you add these types of records to AWS Lightsail?????

Check this:
https://serverfault.com/questions/763815/route-53-doesnt-allow-adding-dkim-keys-because-length-is-too-long
it works" just add two sets of "" a set to cut it and a wrapping set

Related

Can't get a domain verified on AWS after transfer

After transferring a domain from another registrar to AWS, I can't get it verified in the Certificate Manager. I created a hosted zone, the CNAME records created by the Certificate Manager are there, I tried with the DNS tester - the records seem good. However it still says "pending validation". I tried a few times, waited a couple of days and it doesn't seem it will work.
I'm totally out of ideas, any help?
DNS validation require 2 things to be setup correctly. Record Name and Record Value
Check if you're correctly setting these in Route53. Reference Doc here: https://docs.aws.amazon.com/acm/latest/userguide/dns-validation.html
Now 2 issues which are very common
In the Record Name part confirm that you're not adding your domain name in the value. _X is the only part you have to copy-paste. If you copy _X.YourDomain then 'YourDomain' part is duplicated
Record Value ends with . (a period / dot). Don't remove that period
You can verify the settings from https://mxtoolbox.com/ it has various configurations like A record, CNAME, DNS Validation, etc.

How to Search through AWS Route53 Domain records through boto3 sdk?

I want a webpage listing all the Records in a hosted zone from AWS Route 53 and use all the operations like Search, Add and Edit on those records.
Till now, I am able to list all the records using list_resource_record_sets(), also able to Add and Edit a record
using change_resource_record_sets().
But the problem is with searching. I am not able to find any parameter or function for Searching through all the records and get all matching results. The searching should be like it is in AWS console.
How to implement this searching part?
you already found it. It's the list_resource_records_sets
https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListResourceRecordSets.html
or boto:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.list_resource_record_sets
you can pass in additional arguments that narrow down what you are listing. Thisis what the console does.
response = client.list_resource_record_sets(
HostedZoneId='string',
StartRecordName='string',
StartRecordType='SOA'|'A'|'TXT'|'NS'|'CNAME'|'MX'|'NAPTR'|'PTR'|'SRV'|'SPF'|'AAAA'|'CAA'|'DS',
StartRecordIdentifier='string',
MaxItems='string'
)

Configuring GSuite to work with route 53 - "MX record doesn't have 2 fields" error

I'm doing my best to follow GSuite's out of date instructions for routing emails to Gmail via a AWS Route 53 hosted zone (i.e. domain). Here are the outdated instructions:
I set the Values as instructed:
And I see:
Error occurred
Bad request.
(InvalidChangeBatch 400: MXRRDATANotTwoFields (MX record doesn't have 2 fields) encountered with '')
So it will not allow me to create the records.
I had this problem with the new AWS console, but it turns out the problem was me. I had not read the instructions carefully enough.
There needed to be a numeric value (not explained) before the domain name or ip address in the value input. When I added the number, this worked for me in the new console.
I was able to reproduce this exact scenario when I used the new AWS Route 53 interface.
To resolve it I selected the use the old console. link from the top.
I then pasted the values below and it worked.
1 aspmx.l.google.com.
5 alt1.aspmx.l.google.com.
5 alt2.aspmx.l.google.com.
10 alt3.aspmx.l.google.com.
10 alt4.aspmx.l.google.com.
For now use the old console for doing this would be my suggestion.
You need to enter more than one value. This is working fine
There's something wrong with the new Route 53 console. I tried the exact same things in the old console and it worked immediately.
I hope AWS fix this soon. For anyone experiencing this issue in the mean time, try simply reverting to the old console by clicking the link on the left hand panel:
So actually what MX record consists of is a priority and a host. The smaller the number the higher the priority. You can look it up on google as well.
It appears that the cause of the problem is the nature or length of the whitespace between the priority and the host on each line. Reducing all this whitespace - on each line - down to a single space resolved the matter for me.
This seem to worked for me in Route 53
https://support.google.com/domains/answer/3251241?hl=en&ref_topic=6293345#zippy=%2Cset-up-email-forwarding-with-custom-name-servers

AWS CloudFormation keys not accepting special characters

I have noticed that AWS CloudFormation does not like special characters.
When I update a key:value pair in our pipeline.yml file with special char
e.g. PAR_FTP_PASS: ^XoN*H89Ie!rhpl!wan=Jcyo6mo, I see the following error:
parameters[5] ParameterKey, ParameterValue or UsePreviousValue expected
I am able to update the value through the AWS CloudFormation UI.
It seems like the issue is to do with AWS CloudFOrmation parsing the yml file.
Is there a workaround with this issue?
AWS Tags have some restrictions on what they can contain, see here:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions
A key note which can catch people out is: "Although EC2 allows for any character in its tags, other services are more restrictive. The allowed characters across services are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / #."
So I'd check if the service you are adding this onto can support that string.

How to Query Route53 hosted zone to check for an existing record set?

I am new to amazon Route53. As of now, I am able to create a hosted zone and a resource record set in my amazon account. But now I want to search whether a record set already exists in my hosted zone. For Example
Hosted zone "abc.com" and it has two-record set in it.
A.abc.com
B.abc.com
Now I want to query my hosted zone and find out whether A.abc.com already exists in the abc.com.
So, is there any API that I can use where I can pass my amazon credentials and my amazon hostedzone and the searched "record set" and then I can get the result back whether that record set already exists. Kindly guide me.
After research, I found out that there is "ListResourceRecordSet" which will give me the list back for a particular zone. But I don't want the list I just want to check whether the entry already exists.
I have been able to perform this check efficiently using the ListResourceRecordSet API method, and the name and maxitems parameters. You haven't specified how you are accessing the API, so I'm going to explain this using the standard AWS REST API.
Given your example:
Call the API passing A.abc.com as the name parameter and 1 as the maxitems parameter. Your request will look like this: https://route53.amazonaws.com/2013-04-01/hostedzone/{YOUR_HOSTED_ZONE_ID}/rrset?name=A.abc.com.&maxitems=1
Note that I've added a trailing dot (".") to the end of the resource name A.abc.com. The API reference indicates that it may affect result sort order so I add it just in case.
You will get back an XML result in this format:
<?xml version="1.0"?>
<ListResourceRecordSetsResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<ResourceRecordSets>
<ResourceRecordSet>
<Name>A.abc.com.</Name>
<Type>A</Type>
<TTL>3600</TTL>
<ResourceRecords>
<ResourceRecord>
<Value>SOME_IP_ADDRESS</Value>
</ResourceRecord>
</ResourceRecords>
</ResourceRecordSet>
</ResourceRecordSets>
<IsTruncated>true</IsTruncated>
<NextRecordName>B.abc.com.</NextRecordName>
<NextRecordType>A</NextRecordType>
<MaxItems>1</MaxItems>
</ListResourceRecordSetsResponse>
Now you're going to have to do some parsing. Check the result to see if there is one ResourceRecordSet and if its Name property matches the name of the resource record you are looking for (you probably want to do a case-insensitive compare of the two values). Keep in mind that the Name property has that trailing period (".") at the end, so add it to the name you're searching for before doing the comparison.
If there is exactly one resource record set and the name matches the one you are looking for, it exists. If either one of those checks fails, then it does not exist.
Granted, this isn't as simple as a GetResourceRecordSet operation would be, but at least it keeps you from having to query the entire zone and parse a bunch of records. You also won't run into the long delay or throttling issues that you may using the CLI --query option.
There does not appear to be a way to use this method with the AWS CLI as it lacks a --name parameter for some reason. I can vouch for the fact that the JavaScript SDK will allow you to do this using the StartRecordName parameter.
There is no way to filter the API call, but there is a way to filter the data returned. Using the CLI you can do this with the --query option.
From the documentation: "To view all the resource record sets of a particular name, use the --query parameter to filter them out. For example:"
aws route53 list-resource-record-sets --hosted-zone-id Z2LD58HEXAMPLE --query "ResourceRecordSets[?Name == 'A.abc.com']"