AWS Fargate中的文件 [英] Files in AWS Fargate

查看:47
本文介绍了AWS Fargate中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上可以在Fargate中写入/编辑/删除文件吗?

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..

谢谢!

推荐答案

Fargate运行容器.它是容器即服务(CaaS).您的容器(Docker)可以是任何东西,Linux,Windows等.您在Fargate中确实有一个文件系统,无论您在容器中设置什么,它都是OS文件系统.您的应用程序已部署在此文件系统上,并且运行您的应用程序的OS用户对您在容器中为其赋予的本地文件系统具有任何权限.

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.

文件系统是临时的,这意味着当Fargate任务停止并被破坏时,本地存储将随之被破坏.它还限于少量的存储空间,可能只有10GB.

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.

在Fargate中,您实际上无法安装卷,例如EBS卷.如果需要执行此操作,则要使用容器或原始EC2实例,则必须在ECS中使用EC2启动类型任务,而不要使用Fargate启动类型ECS任务.这不会阻止您对容器内的本地文件系统进行读/写/删除访问.

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.

因此,您可以编写本地临时文件.如果您需要在Fargate任务结束后保留​​数据或保存大量数据,则需要写入其他一些存储,例如S3或RDS.

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

现在,在ECS和Fargate中挂载EFS卷为

Mounting EFS volumes in ECS and Fargate is now generally available.

这篇关于AWS Fargate中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆