Getting connection refused on http calls from circleci

I am getting a connection refused on a call to an API hosted on ec2. The strange thing is that every other person can test this URL and it works, but doesn’t work on circle ci.

I even downloaded the container to my local machine and ran the commands from there and it works. Does circleci block some HTTP calls?

export API_URL="http://${BACKEND_IP}:3030/api/status"
echo "${API_URL}"
if curl -s -v "${API_URL}" | grep "ok"
then 
   return 0
else 
   return 1
fi

One thing, you do not say what type of environment you are trying to run this script in.