Currently, with rexray, I'm creating an EBS volume per task on each availability zone. I'm looking for a way in which I could create a separate, independent volume for each task instance. To illustrate:
- 1 ECS service configured across 2 availability zones, set task desired count to 3
- Task definition that creates an EBS volume
- The above two creates two volumes, one in each AZ
In the above scenario, two tasks would connect to one volume, and the other task to the other volume.
Is there any way in which I could provision an EBS volume for each instance of a task? The main goal is to have many instances of a task with each their own volume, it would not be a problem if they are attached in a different order when there's a redeployment, but it is important that two tasks do not use the same volume.
You can't do this. Instances of tasks in an ECS service are meant to be interchangeable, disposable and same.
I think that for your use-case, a EFS would be better, as you can programmatically, from your app, control access to it.