Lew*_*ith 5 amazon-web-services amazon-ecs node.js docker aws-application-load-balancer
Okay so this is going to be a long one, but I want to make sure I explain. I am trying to do a proof of concept that we can deploy micro services via ECS that are exposed using API Gateway so we can leverage the lambda authorisers and cognito.
To achieve this I have been following this guide on Medium
However once I deploy my gateway I am faced with the following error:
Cannot GET /node-demo
Run Code Online (Sandbox Code Playgroud)
Let me go through the basics, I have a basic express application like so:
const express = require('express')
const PORT = process.env.PORT || 3000
const app = express()
app.get('/', (request, response) => {
return response.json({
data: {
message: `API is functional`,
},
})
})
app.listen(PORT, () => console.log(`App running on port ${PORT}`))
Run Code Online (Sandbox Code Playgroud)
Dockerfile looks like this:
FROM mhart/alpine-node:10.16.3
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY index.js .
CMD ["npm", "start"]
Run Code Online (Sandbox Code Playgroud)
This docker image has been pushed to ECR, I have created a Task Definition with an environment variable PORT => 80
Created a service on my cluster which is working fine. Then created an ALB with a target group that points to my containers, these come back healthy!
And I route to these targets with the following:
My NLB then points to the ALB and I have allowed the correct IPs on the ALB so we can get to it through the security group. Both IPs in the NLB target group are healthy
Created a VPC link in API Gateway and then created a resource like the below:
I then deploy hit the URL with /node-demo at the end and get the initial error above. Either the guide has a mistake or I've done something fundamentally wrong.
| 归档时间: |
|
| 查看次数: |
143 次 |
| 最近记录: |