How do you tag and name the EC2 Instance that was launched by an EC2 Spot Request?

Spot instances requests are a type of EC2 resource. The AWS documentation notes that this type of resource can be tagged, but the resulting tags are not carried over to the actual instances:

The tags that you create for your Spot Instance requests only apply to the requests. These tags are not added automatically to the Spot Instance that the Spot service launches to fulfill the request. You must add tags to a Spot Instance yourself when you create the Spot Instance request or after the Spot Instance is launched.

So you'll need to add the tags after the instances have launched. You have some options here:

  • User Data Script on the created instance: Write a user data script that uses command line tools and the EC2 meta data service to allow the instance to discover its instance Id and create tags for itself. You can use the AWS CLI create-tags to tag any of your EC2 resources. Alternatively, you could bake this into the AMI as a startup script for whatever OS you intend to use. In either situation, the instance will have to have sufficient permissions to create EC2 tags for itself.
  • External Utility that monitors your spot request: You can use one of the AWS SDKs to monitor your spot request and tag the instances once they have been created. AWS has a tutorial on this very topic under the "How to Tag Your Spot Requests and Instances" header. Without getting too verbose, this simply involves polling Describe Spot Instance Requests until a created Instance Id is available, and then calling Create Tags.

You can now supply tags to your SpotFleetLaunchSpecification when creating a spot fleet request, and those tags will be applied to new instances in that fleet automatically.

http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotFleetLaunchSpecification.html