AWS Route53 weighted record synced only one entry

Hello,

I have configured two weighted records in Route 53 with the same record name and type:

  • Record name: A

  • Type: CNAME

  • Routing policy: Weighted

  • Weights: 10 and 0

Both records exist in Route 53, but when I query the aws_route53_hosted_zone_resource_record_sets table, only one of these records is returned.

Could you confirm if this is expected behavior for weighted records with the same name, or if there might be an issue with the data synchronization to this table?

Thank you.

Hey @Karl,

First things first, welcome to the CloudQuery community! :waving_hand:

The aws_route53_hosted_zone_resource_record_sets table actually uses APIs similar to what the list-resource-record-sets — AWS CLI 2.28.6 Command Reference CLI command would, so could you try that out and let us know if the behaviour is different? Could you share the output with us?

Since the Primary Key on that table is built out of Name and Type, I would expect one of two things to happen:

  1. either both records are returned but the first one is dropped due to the PK conflict, or,
  2. the AWS API & CLI actually only return a single record

Looking forward to your reply!

@stefan Thanks for checking!
I ran the AWS CLI list-resource-record-sets command, and it returns both records.
It seems like the PK conflict issue you mentioned.

$ aws route53 list-resource-record-sets --hosted-zone-id <id> | jq '.ResourceRecordSets[] | select(.Name == "<name>")'
{
  "Name": "<name>",
  "Type": "CNAME",
  "SetIdentifier": "active",
  "Weight": 10,
  "TTL": 300,
  "ResourceRecords": [ ... ]
}
{
  "Name": "<name>",
  "Type": "CNAME",
  "SetIdentifier": "inactive",
  "Weight": 0,
  "TTL": 300,
  "ResourceRecords": [ ... ]
}

When I run this query, only one record is returned.

SELECT * 
FROM public.aws_route53_hosted_zone_resource_record_sets
WHERE EXISTS (
    SELECT 1
    FROM jsonb_array_elements(resource_records) AS record
    WHERE record ->> 'Value' = '<name>'
);

If the intention is to behave similarly to the AWS CLI list-resource-record-sets output, it would be great to have this fixed. Should I open a GitHub issue for it?

1 Like

We managed to reproduce it and included a fix for this in the last version of the AWS plugin, v32.37.0, released today.

Feel free to update to the latest version and let us know if this does it for you.

1 Like

@stefan Thanks for the quick fix — I’ve confirmed it works fine with v32.37.0.

FYI, as a side effect of including it in the PK, I’m seeing the following warning log when synchronizing plain (non-weighted) records:
WRN resource resolver finished with validation warning error="missing primary key component on columns: [set_identifier]"

Anyway, thanks again!

Hi @Karl sorry for the trouble, the warning should be fixed in v32.37.1 of the AWS plugin

2 Likes

@erez No worries at all! Really appreciate the fix :raising_hands: (CloudQuery fan for life :grinning_face_with_smiling_eyes:)