Ross Ross - 6 months ago 40
PHP Question

AWS EC2 Spot Instance PHP add tag when making spot request

I'd like to be able to include a tag when making a spot request via PHP. When creating on-demand instances, you can create the instance, then use it's instance to issue the following:

$ec2->create_tags($instance_id, array(
array('Key' => 'Name', 'Value' => 'MyTestMachine'),

However, when issuing a spot bid, the instance isn't started right away, so you'd have to create a watcher tag to deal with this...unless you can add a tag in the request phase. I haven't found any documentation to show how this would go or look like, does it exist?

Answer Source

the answer is that you cannot assign a tag until the instance is actually created. In order to tag this I have used a listener daemon to watch new instances and tag them once they've started.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download