This can be done using UserData - if you are using a linux host with cloudinit and awscli installed , you can run the following in the UserData script to mark all volumes associated with the instance
"VOLUME_IDS=$(aws ec2 describe-volumes --output text --filters Name=attachment.instance-id,Values=$(curl http://169.254.169.254/latest/meta-data/instance-id) --query 'Volumes[].VolumeId')",
"aws ec2 create-tags --resources ${VOLUME_IDS} --tags Key=my,Value=tag"
make sure that when you start your EC2 instance, it has an IAM instance policy that allows you to create tags and describe volumes
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:CreateTags",
"ec2:DescribeVolumes"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
source
share