Jananath Banuka
Jananath Banuka

Reputation: 3863

How to mount S3 bucket to ecs fargate container

I have an aws ecs fargate cluster. it is a ecs-fargate cluster not an ecs-ec2 cluster. And I am running some containers where I need to mount a volume. Is it possible to mount an s3 bucket to this fargate container?

If so, how can I do that?

If not, what are the other options I can follow? I want to preserve these data for later use (for disaster recovery and also for later access)

Upvotes: 5

Views: 16911

Answers (2)

yair_elmaliah
yair_elmaliah

Reputation: 137

As of now there no direct way to mount s3 buckets to ecs tasks. One option you can follow is by using AWS DataSync to sync s3 bucket into efs , and mount efs to your ecs task. here is a great article on how you can implement such task

DataSync is a great solution if you want to sync the data periodically every x hours/days.

If you need the data to be synced inside the container the exact moment you make a change in your s3 bucket, you can trigger a lambda function that will sync the data for every new upload to s3, see https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html

Upvotes: 0

Mark B
Mark B

Reputation: 200476

As mentioned in the comments, mounting S3 is a bad idea, and it won't work in your Fargate containers anyway. Currently the only option for mounting external volumes in Fargate is to use Amazon EFS.

Upvotes: 1

Related Questions