Kong acme plugin not working

I am trying to generate certificates from lets encrypt for kong. I am using acme plugin for the same and i am following https://docs.konghq.com/hub/kong-inc/acme/

Everything is working as expected but when i try the step

curl https://example.com -k (putting in my actual domain name)

The response i am getting is

<head><title>521 Origin Down</title></head>
<body bgcolor="white">
<center><h1>521 Origin Down</h1></center>

what could be wrong.

Additional Information: I am using an AWS ec2 instance for kong server and port 443, 8000, 80, 8001 is open.

Also, i have already created an A record for the domain in cloudflare.

@Wangchong_Zhou might be able to help out here.

This feels like a cloudflare specific issue, maybe check the ec2 security group setting?