How to automatically mount volume from inside an ECS instance?

I am building an ECS cluster and they need to have a more than 8GB of Scratch space. When creating the cluster, it successfully creates an EBS drive of the space desired on /dev/xvcdz. However that volume is not formatted nor mounted.

It’s quite easy to fix this by logging in ssh and running
sudo mkfs.ext4 -E nodiscard /dev/xvdcz && sudo mkdir -p /scratch && sudo mount /dev/xvdcz /scratch

However this is not a very useful use case for ECS instances managed through auto scaling…
I would need this to be done at boot…
Most resources I have found online is to do that inside the User Data part of the Launch Configuration. However, touching that value (and even reverting it after) causes it to not be executed at boot. The instance does not register to my cluster and by logging in it I see the docker agent is running on agent ‘default’, which means the User-Data hasn’t run :(. The volume hasn’t been formatted either.

Documentation is very scarce. If someone has an answer, it would be much appreciated. Thank you!

Source: StackOverflow