Search code examples
amazon-ec2amazon-ecs

Amazon ECS host directory access


I have a solution running locally with docker that I'm trying to deploy at AWS, using ECS. Locally, I have an nginx container that I'm supplying conf files to by using volumes in docker-compose.yml:

volumes:
    - ./nginx:/etc/nginx/conf.d

In the ./nginx directory I have two (site-specific).conf files that give configs for a couple of sites. It works beautifully. But when I try to use the ECS Task definition UI, the volumes area doesn't seem to allow any way to make a dir on the EC2 host available to a container. In the 'mount points' area, the source dropdown is always empty, and when I type something like '/nginx:/etc/nginx/conf.d' in the container path field, nothing is saved.

Any ideas how I can access an EC2 dir from a container in ECS? Thanks for any help...


Solution

  • Create a folder /opt/foo on the instance and put your config there.

    In the UI create a new volume for the task definition and give it a name and the path /opt/foo

    Within the container portion of the task definition in the UI STORAGE AND LOGGING will have a drop down for Mount points that will now have the name from the previous step. Choose that and set the container path to where nginx inside the container expects it.