I want my persistence (ebs) volume to be separate from my auto-scaling group launch configuration. So that it won't be accidentally auto deleted by terraform, or something. Also I may do something like /mnt/taskname
so that I have a different persistence volume for each task that needs data.
Here's how I think it would work.
- install aws-cli for some reason it's missing (packages in cloud init), which happens late?
- use aws command to attach the volume
- format the volume using fs_setup in cloud init
- mount the partitions using mounts in cloud init
Problem is that this won't work though because 1 wouldn't happen until after 3 and 4 (I think), and I'm not really sure if 2 is the right way to go to attach the volume.
Maybe I shouldn't be using the ecs optimized image? seems like that would solve my issue, but then I'd have to figure out what to change the amazon (base?) image to have it otherwise configured like the ecs image? maybe there's another way to attach the volume than the aws
command? maybe some other magic than what I'm considering entirely?
This is a partial answer as i'm still working through it, first, I'm using a plain Amazon Linux AMI, not the ECS optimized one (which is out of date...)
here's the most important part, the
attach_volume.sh
, which will attach the volume, then partition it and format it if necessary.then we can use the standard cloud config to mount it