Is it possible to actualy write/edit/delete files in Fargate ?
Since it's serverless and it doesn't really have a filesystem, I couldn't get a clear answer about this.
For example, one of our clients needs to write some temporary cache files on the local container. Is this possible ?
I don't want to setup a whole Data Container Volume just for this..
Thanks !
For Fargate task definitions, you're required to specify CPU and memory at the task level. You can also specify CPU and memory at the container level for Fargate tasks. However, doing so isn't required. For most use cases, it's OK to specify these resources at the task level only.
AWS Fargate is a serverless, pay-as-you-go compute engine that lets you focus on building applications without managing servers. AWS Fargate is compatible with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS).
PDFRSS. When provisioned, each Amazon ECS task that are hosted on AWS Fargate receives the following ephemeral storage for bind mounts. This can be mounted and shared among containers that use the volumes , mountPoints , and volumesFrom parameters in the task definition.
' ECS delivers more control over the infrastructure, but the trade-off is the added management that comes with it. Fargate is the better option for ease of use as it takes infrastructure management out of the equation allowing you to focus on just the tasks to be run.
Fargate runs containers. It is Containers as a Service (CaaS). Your container (Docker) can be anything, Linux, Windows etc. You DO have a filesystem in Fargate, it is OS filesystem whatever you setup in your container. Your application is deployed on this file system and the OS user running your application has whatever permissions to the local filesystem that you give it in the container.
The file system is ephemeral meaning when your Fargate task stops and is destroyed, your local storage will be destroyed with it. It is also limited to a small amount of storage, maybe 10GB.
In Fargate you actually cannot mount a volume, like an EBS volume. If you need to do this you have to use EC2 launch type task in ECS instead of Fargate launch type ECS tasks if you want to use containers, or use a raw EC2 instance. This does not prevent you from read/write/delete access to the local file system inside your container.
So you can write local temp files just fine. If you need to persist the data after the life of the Fargate task or very large amounts of data, you need to write to some other storage like S3 or RDS.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html
Edit: Mounting EFS volumes in ECS and Fargate is now generally available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With