Pulling docker image from ECR using task definition

0

Hi, Im trying to setup my web app manually because I dont want to dive straight into Infrastructure as code or tools, if possible I want to know and play around with the AWS components.

I have this EC2:

https://preview.redd.it/twvyd2988sw71.png?width=2346&format=png&auto=webp&s=95b4fd078f951876008fefc00718e25cd6562661
https://preview.redd.it/pp7yw4ma9sw71.png?width=2324&format=png&auto=webp&s=5793c19df39598c82e674e1f153acdff2705de84

And put it inside my ECS cluster:
https://preview.redd.it/kyxkldwh8sw71.png?width=2362&format=png&auto=webp&s=393cfc53e4d2c61e14f416025b2ad3e5bdc5beec
I have this postgresql RDS:
https://preview.redd.it/j6qy6a9s8sw71.png?width=2282&format=png&auto=webp&s=0c97237d6952bccc0d83cbb4b27666462b02dc94
This is the security group I set up for ec2 to connect to rds:
https://preview.redd.it/ehlynue49sw71.png?width=2308&format=png&auto=webp&s=5c8afa220bf94bea48f158b441484ecd24078184
I have set up a task definition to pull docker image from my ECR:
https://preview.redd.it/uh41nlui9sw71.png?width=1704&format=png&auto=webp&s=71644541501c4d9fd949c454323ccb9307e3d9cb
https://preview.redd.it/2zl2680m9sw71.png?width=2374&format=png&auto=webp&s=ed8a1268221025b17850a8ebf4621e81db4c563d
https://preview.redd.it/1q6b6zhr9sw71.png?width=2372&format=png&auto=webp&s=1220c9cc9728180a7c2af329361c85765cde419b

I have run the task definition on my cluster but it always fail at the step to connect to the RDS database:
https://preview.redd.it/05ecxwtpasw71.png?width=2310&format=png&auto=webp&s=f061ccbaf246d924431c7aaf7b40d8b603c6fa1b

I have telnet and psql to that address from EC2 terminal and it is successful. Why am I not able to run docker image from task definition? I think it pulled from ECR correctly but when running the docker image, it is not able to connect to the db. Thanks

Update: I changed network setting of the task to awsvpc instead of bridge, and set it to security group of my EC2. It keeps running with no logs. I dont know what is happening, whether the web app is deployed or not.

asked 2 years ago343 views
1 Answer
0

Turns out I look at the wrong ec2

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions