0

I am in the following situation:

I have created a small express.js application with an Alive endpoint, as following:

app.get("/", (req, res) => {
  res.status(200).send({
    message: "Alive"
  });
});

app.listen(5000, '0.0.0.0', () => {
  logger.info("Running on ECR through Fargate")
});

I have successfully created a Docker image via my Dockerfile:

FROM node:14
EXPOSE 5000
WORKDIR /home/node/app
COPY package.json package.json
RUN npm i
COPY . .
CMD [ "npm", "run", "dev" ]

When I run the image locally

docker run -d --publish 5000:5000 <name>

It works perfectly

enter image description here

I then proceed to upload my image to my ECR repository after I have tagged it with "latest". I have created a cluster and a task defition.

Task defition:

  • Task memory (MiB)1024
  • Task CPU (unit)512
  • Compatible with Fargate
  • Host Port: 5000
  • Container Port: 5000
  • Protocol: tcp

If I go into my cluster and take a look under the logging I see the following message:

enter image description here

Which is my start-up message. So everything -seem- to work absolutely fine. But when I use postman to send a GET to my task's public IP I get either an ECONNREFUSED or ETIMEDOUT.

I can't work out what I am doing wrong, I have followed a bunch of tutorials online and I am very sure I have done exactly like they do. Does anyone have any idea what I am doing wrong?

springsomfan
  • 135
  • 1
  • 5

1 Answers1

0

As per the comments in the thread, the issue was that that the Security Group associated to the Task ENI did not allow port 5000 through from ANY source.

mreferre
  • 5,464
  • 3
  • 22
  • 29