I am creating an instance through the cloud formation script.
The only way I found to attach an OS partition was through \"BlockDeviceMappings\" property. (I\'ve tried t
This is what I did in my ec2 userdata. I think it's much simpler than above answer.
Key=
Value=
Region=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | grep -oP "(?<=\"region\" : \")[^\"]+")
aws ec2 create-tags --resources $(aws ec2 describe-instances --instance-ids $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --region $Region | grep -oP "(?<=\"VolumeId\": \")[^\"]+") --tags Key=$Key,Value=$Value --region $Region