Aws ecs n8n The DNS server returned an error, perhaps the server is offline

Information on your n8n setup

  • Running n8n via: AWS ECS

Error adding an API: The DNS server returned an error, perhaps the server is offline

After checking for possible answers have added to the Terraform: Module

        { name = "N8N_LISTEN_ADDRESS", value = "0.0.0.0" },
        { name = "NODEJS_PREFER_IPV4", value = "true" }

Also tried

        { name = "N8N_LISTEN_ADDRESS", value = "::" }

Hi, Carlos!

First, confirm whether DNS fails int this situation by resolving the hostname (nslookup, dig) or trying to reach it via https (curl). If it fails, n8n cannot reach the api by design.

Ensure your ECS task has outbound internet acess and proper DNS resolution.

I’ve hit similar DNS hiccups on ECS, and tweaking env vars only got me halfway. What finally helped was forcing the task to use IPv4-only networking and testing resolution from inside the container with simple dig commands. I also double-check endpoints against something stable like usa dns server, which has saved me from a few wild goose chases. If resolution fails inside the container, the issue is usually with the task’s network config rather than n8n.