I am thinking about using an ECS cluster based on spot instances. In order to keep containers' data save, I want to use EFS, so all instances will be connected to it and all containers will store their data on EFS. In this case, even if an instance is terminated, the data will be untouched on EFS, When a new instance is relaunched all containers will get their data mounted.
It is just an idea, will it work? Are there any cons?
Yes it will work.
Example: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_user_data_scripts.html