I’m using Terraform to upload a web to AWS. This ECS, with a docker image, that errors with 500 when I try to go to it’s assigned A-record DNS name. For this service, I’ve assigned a few AWS resources:
- AWS role
- AWS policy
- AWS elastic load balancer (elb)
- AWS ecs cluster
- AWS ecs service
- AWS ecs task definition
The Docker image:
<some-image>
The corresponding configuration is:
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
]
Running the docker container locally, gives me a successful response. So clearly I’m missing some resources.
I asked around and it seems the elb doesn’t have a backing container host. Does that mean I need an ec2 ami and instance? Here's what my aws terraform config looks like (with my failed attempts at ami and instance configs).
I don’t see a way in terraform, to point those resources to an secs cluster or service. Going the opposite direction, nowhere in the ECS cluster, service or task definition, do I see a way to define an AWS ami or instance. How do I configure this in terraform?