Is the application stateless or stateful?
Going through the literature, it all boils down to one definition: An application that neither reads nor stores information about its state from one time that it’s run to the next is a stateless application.
Containers take the stage!
Since containers were designed to be stateless and totally ephemeral when they were introduced, running stateless applications on containers is a perfect decision.
A significant part of the applications in the wild need to retain a state of some kind, especially the ones that are not container-native applications. Some of them need object storage, others need databases while some of them need block storage.
With this latest feature announced by Amazon Web Services (AWS), the ones that are Amazon Elastic Container Service (ECS) hosted applications and need block storage, are greatly impacted. Their maintenance and resiliency got a huge improvement.
How did we do it till now?
We did it with Amazon Elastic Block Store (EBS) volume, used by the Amazon ECS Task – which detaches and re-attaches automatically when the Amazon ECS Task restarts – and with a backup procedure for that Amazon EBS volume because Amazon EBS volumes can’t span availability zones (AZs).
The new solution – Amazon EFS
Speaking of the new solution, we can definitely say – Amazon Elastic File System (EFS). The reasons are clearly stated in the Amazon EFS documentation as highlighted below.
Q. How is Amazon EFS designed to provide high durability and availability?
Every file system object (i.e. directory, file, and link) is redundantly stored across multiple Availability Zones. In addition, a file system can be accessed concurrently from all Availability Zones in the region where it is located, which means that you can architect your application to failover from one AZ to other AZs in the region in order to ensure the highest level of application availability. Mount targets themselves are designed to be highly available.
Q. How much data can I store?
Amazon EFS file systems can store petabytes of data. Amazon EFS file systems are elastic and automatically grow and shrink as you add and remove files. You do not provision file system size upfront, and you pay only for what you use.
As a closing reason to use Amazon EFS with Amazon ECS – as persistent storage for both new and existing applications – is the smooth transition and usage out of the box shown in the image below.
Attaching EFS to ECS task
If you have any questions, feel free to send me an email on email@example.com.