Passing a custom conf file to ECS task definition

Viewed 4607

Actually I have a simple use case, where I have to pass a custom config file in my ECS task definition. Example- Let's suppose I want to run Nginx as a service in ECS cluster and now I have to pass my custom nginx.conf to ECS task definition. I am not able to figure out any possible way to do so. I was doing the same kind of thing in kubernetes using config maps and secrets, and after that mounting them to docker containers. How can I achieve the same in ECS?

1 Answers

You can't pass any custom configuration via task definition. However, I can think of two different approaches below, pick one that fits your bill:

1 - Bake the custom configuration inside your image via Dockerfile. This is comparatively cost-effective. 2- Use docker volume to mount the configuration from the host into the container. Now that both EC2 and Fargate launch types support EFS, you can use EFS volume if you want to have one volume mounted on to multiple containers on multiple hosts. Here's a step-by-step guide from AWS documentation.

Related