Use Cloudfare API to set server NS names in AWS Route 53

I have an app with a domain registered with AWS Route 53, have my static files hosted on an S3 bucket and want to use Cloudflare as CDN.
Cloudflare suggests changing four NS names from Route 53 with two given by Cloudflare. This can be done manually.

Since I am building an IAC tool, I want to use the Cloudflare API to automate this process. I want to query Cloudfare’s API and receive these records. Any suggestion of the endpoint?
Thanks

Your question is not overly clear.

You cannot use Cloudflare’s API to change things on Amazon, however there are calls which allow you to query the actual values of DNS records → Cloudflare API v4 Documentation

I just santa thé valise givrn vu Cloudflare and use AWS API to change accordingly

I am afraid it still is not clear what you want to do.

I suggest you check out the documentation mentioned earlier and pick the calls most suitable for your task.

And yes, you will have to the change the nameservers, but that’s completely unrelated to any API.

You best check out support.cloudflare.com as well.

Yes sorry, the writing is horrible!
My intention is to find an endpoint of Cloudflare’s API that gives me two NS records for a given domain from Route 53. With this I can change the records in Route 53 accordingly.
Is this more clear?

As I mentioned earlier Cloudflare won’t give you anything that is Amazon related. You can use the call that I linked to earlier to fetch data that you have configured on Cloudflare and that’s it.

If you are looking for the Cloudflare nameservers then you can get them via Cloudflare API v4 Documentation.

Thanks. So it seems I can get these nameservers with the Cloudflare’s API “List an account’s custom nameservers” (via a GET accounts/:identifier/custom_ns)

Then Cloudflare support says: “AWS customers must update their domain’s nameservers to point to the Cloudflare nameservers listed in the Overview app of the Cloudflare dashboard”. I can do this by calling AWS API with the result of Cloudflare’s query.

If you want to get the nameservers assigned for a domain you can do this via aforementioned call. Then you set it on Amazon, if that is your registrar, in whatever way they provide here, but that would be something Amazon related at that point.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.