Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the volumes located when using ECS and Fargate?

I have the following setup (I've stripped out the non-important fields):

{
    "ECSTask": {
      "Type": "AWS::ECS::TaskDefinition",
      "Properties": {
        "ContainerDefinitions": [
          {
            "Name": "mysql",
            "Image": "mysql",
            "MountPoints": [{"SourceVolume": "mysql", "ContainerPath": "/var/lib/mysql"}]
          }
        ],
        "RequiresCompatibilities": ["FARGATE"],
        "Volumes": [{"Name": "mysql"}]
      }
    }
}

It seems to work (the container does start properly), but I'm not quite sure where exactly is this volume being saved. I assumed it would be an EBS volume, but I don't see it there. I guess it's internal to my task - but in that case - how do I access it? How can I control its limits (min/max size etc)? How can I create a backup for this volume?

Thanks.

like image 818
Gilad Novik Avatar asked Jan 09 '18 10:01

Gilad Novik


People also ask

Where are Docker volumes located?

Volumes are stored in a part of the host filesystem which is managed by Docker ( /var/lib/docker/volumes/ on Linux). Non-Docker processes should not modify this part of the filesystem. Volumes are the best way to persist data in Docker.

How do I mount EBS volume on ECS container?

create an ECS Cluster built on top of 2 EC2 instances. The REX-Ray docker plugin will be installed on both of the instances. create an ECS Task definition for the Postgres database. The task definition will include the Docker volume configuration required to use the REX-Ray volume driver to attach a new EBS volume.

Where do fargate tasks run?

Improved Security: In Fargate, tasks run in their kernels that are entirely isolated from the underlying infrastructure. All you need to do is embed security within your container, and your IT infrastructure is protected through the secure isolation of Fargate.

Can you use EBS with fargate?

Currently, Amazon ECS supports Amazon EBS volumes for tasks hosted on Amazon EC2 only. Support for Amazon EBS volumes isn't available for tasks on Fargate.


1 Answers

Fargate does not support persistent volumes. Any volumes created attached to fargate tasks are ephemeral and cannot be initialized from an external source or backed up, sadly.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html

like image 183
sj26 Avatar answered Oct 10 '22 03:10

sj26