| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
To help categorize and manage your Spot Instance requests, you can tag them with metadata of your choice. You tag your Spot Instance requests in the same way that you tag other Amazon EC2 resources. Create a tag by specifying a key and value, and assigning the pair to the Spot Instance request. You use the CreateTags action or the ec2-create-tags command. For information about how to use tags, see Tagging Your Amazon EC2 Resources.
The tags you create for your Spot Instance requests only apply to the requests. These tags don't propagate to the instances that the requests launch. To categorize the Spot Instances that are launched from your tagged request, you must create a separate set of tags for the instances using the same commands.
For example, you have Spot Instance request sir-69047e11 and you want to label it with the tag Spot=Test.
To do this, use the following command:
PROMPT>ec2-create-tags sir-69047e11 --tag "Spot=Test"
Amazon EC2 returns this information:
TAG spot-instance-request sir-69047e11 Spot Test
You can also confirm the tag information by using the ec2-describe-tags command.
When your request is fulfilled and a Spot Instance launches, you will see that the tag you used for your Spot Instance request is not applied to the Spot Instance. In the following example command, we are obtaining information about the Spot Instance i-b8ca48d8 that was launched as a result of your Spot Instance request sir-69047e11, tagged Spot=Test.
PROMPT>ec2-describe-instances i-b8ca48d8
The call returns details about the instance with no tag information, showing that the tag for your Spot Instance request does not apply to the Spot Instance that the request launched. To tag your Spot Instance, use the following command:
PROMPT>ec2-create-tags i-b8ca48d8 --tag "SpotI=Test1"
Amazon EC2 returns this information:
TAG instance i-b8ca48d8 SpotI Test1
You can create similar tags using the API. For more information, see the API section of Tagging Your Amazon EC2 Resources.