Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistence in AWS Fargate Containers

I have 2 containers in a Fargate task definition. One of the containers is a database server. I'm wanting to persist the data directory. However, Fargate doesn't support the Source Path field when setting up a volume in the task definition. Does anyone know who to set up persistence in Fargate?

like image 844
Ira Klein Avatar asked Dec 02 '17 19:12

Ira Klein


People also ask

Does fargate support persistent storage?

Having a persistent storage layer for your pods makes Fargate suitable for Kubernetes workloads like data analytics, media processing, content management, web serving, and many others that require functionalities like low latency, high throughput, and read-after-write consistency.

What is persistent storage in AWS?

The term data persistence means that the data itself outlasts the process that created it. Data persistence in AWS is achieved by coupling compute and storage services. Similar to Amazon EC2, you can also use Amazon ECS to decouple the lifecycle of your containerized applications from the data they consume and produce.

Is EFS data persistent?

EFS data can be accessed from all availability zones in the same region while EBS is tied to a single availability zone. EFS has the capability to mount the same persistent volume to multiple pods at the same time using the ReadWriteMany access mode.

Is fargate ephemeral?

Fargate tasks using Windows platform version 1.0.0 or later receive a minimum of 20 GiB of ephemeral storage. You cannot configure the ephemeral storage for Windows containers on Fargate. The ephemeral storage is encrypted with an AES-256 encryption algorithm, which uses an AWS owned encryption key.


3 Answers

AWS Fargate at this moment is targeted to stateless container solutions only, but we never know, maybe AWS is already working in a solution for it.

Remember you are sharing the same host with other AWS Customers. Your instance could be terminated and restarted in another host anytime. You also can scale out your service anytime.

You can use any of the options below:

  • use RDS for general purpose databases.

  • If your DB is not available you can start a new EC2 and install the database

  • continue to use fargate for the other services.
like image 147
Alessandro Oliveira Avatar answered Oct 06 '22 20:10

Alessandro Oliveira


AWS Fargate supports EFS volumes, at last!

like image 38
Alexander Shcheblikin Avatar answered Oct 06 '22 21:10

Alexander Shcheblikin


I can think about 3 ways to do this:

  • use a storage solutions compatible with containers workload (longhorn or portwork are good calls)
  • use RDS
  • use a distributed database that can have multiple copies of it's data (but you will have to take care of the case all the copies where shutdown)
like image 1
webofmars Avatar answered Oct 06 '22 21:10

webofmars