cfn-modules / docs

Rapid CloudFormation: Modular, production ready, open source.
https://github.com/cfn-modules
Apache License 2.0
260 stars 40 forks source link

[Question] fargate-alb-proxy-pattern Nginx configuration #35

Closed jmajonis closed 4 years ago

jmajonis commented 4 years ago

Thank you for your excellent collection of cfn-modules repositories. I am very new to CloudFormation and ECS and it's been a great help seeing complex examples of CloudFormation templates working together and following best practices.

I am trying to implement the fargate proxy pattern described here: https://github.com/cfn-modules/docs/blob/master/examples/fargate-alb-proxy-pattern/example.yml

Where the proxy is Nginx relaying port 80 from the ALB to port 3000 on the app container.

Can you please point in the direction of a suitable nginx.conf configuration for this arrangement?

I have tried in nginx.conf

upstream rails_app { server app:3000; }

resulting in error

nginx: [emerg] host not found in upstream "app:3000" in /etc/nginx/conf.d/default.conf:3

I don't understand how to represent Fargate awsvpc networked containers in the nginx.conf file. Any help would be appreciated. Thank you.

michaelwittig commented 4 years ago

Hi @jmajonis

use localhost, not app and you should be fine.

Let me know if it works.

jmajonis commented 4 years ago

@michaelwittig yes, that worked, thank you!