I’ve recently transferred a domain to Cloudflare and created a CNAME record pointing to the public FQDN of my EC2 instance.
Inside the instance I have a script that at each boot queries the metadata server, gets the public hostname and update via api the CNAME record.
Now, despite everything is working fine, when I try to resolve the CNAME record content, instead of getting the EC2 instance public hostname, I get the two IPs of Cloudflare.
I also tried with a A record to the public IP of the instance but it didn’t work either as I still get the same two IPs from Cloudflare.
Can anybody help me spotting what I am doing wrong?
I’ve spoken too soon.
Actually having the CF proxy protection for A/CNAME records pointing toward public EC2 instances is not possible.
To be able to reach them I had to disable the proxy feature, then I started to properly resolve my CNAME and thus I reached the instance.