I have found the original script from a post by Leon Mergen. See also raid_ephemeral.sh from Joe Miller
I updated it for my needs, which were:
- Work independently of device name (/dev/sdX, /dev/xvdX or /dev/nvmeXXX)
- Avoid mounting a device which is already in use (some ami will mount the first epehermal device)
- Avoid using metadata, as it's not trustworthy when using launch templates. This means the script does not know if the devices are EBS or Ephemeral. I would recommend not to use this if you have a mixed EBS/Ephemeral instance, as the volume will be corrupted if the instance is stoped.