I am creating 3 EC2 instances, and subsequently iterating and tagging each of them. Sometimes the tag request fails, although the instance later appears to be running.
Tag name cannot be created until the instance is launched . You might try giving the key_name while creating the instance. If you are using boto, it could be done by
reservation = conn.run_instances(1, 1, instance_type='m1.small', key_name='samplename')
Then instances can be retrieved by passing key_name and once they are in running state, you can also give them the tag name.