amazon web services - Cloudformation : Autoscaling persist volume after instance stop and add tags -


i using cloudformation template , using autoscaling in it.

i able persist volumes when delete stack, not able attach tags volumes via cloudformation.

is there way ?

or possible create aws::ec2::volume , attach autoscaling group in cloudformation. have tried not able this.

basically objective whenever instance terminated want persist volumes , volumes must contain tags can identify them.

the following cloudformation types using in template :

aws::autoscaling::launchconfiguration
aws::autoscaling::autoscalinggroup

thanks.

the way came doing uses userdata when instances launches to

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=your,value=tag 

a similar question asked on aws developer forums


Comments