2023-04-29

How can I deploy a simple server container to ECS Fargate?

I've been trying to deploy my container for the last 8 days all day, but still can't (I know)

It is a simple express.js API that listens for http requests on port 80

Before building the image and pushing it to DockerHub I created an endpoint for the "check health status":

app.get("/health", (_, res: Response) => res.sendStatus(200));

const port = process.env.SERVER_PORT;

app.listen(port, async () => {
  console.log(`Server is listening on port ${port}. 🚀`);
});

I checked this path on my local machine and it seems to be working: Print screen

Then I tried deploying it to AWS ECS Fargate: Created the cluster, created the task definition following the instructions that I used in the docker-compose.yaml file, created a service based on the task definition I created and launched that service. At the AWS console everything seems to working fine too: Print screen

So I tried sending a HTTP request to the DNS name of the Load balancer /health, and also to the IP/port address /health, but the requests all timeout: Print screen



No comments:

Post a Comment