While creating EC2 launch templates with the create-launch-template
AWS CLI ec2
command and a JSON spec, I can't seem to figure out how to tag the template itself. I'm providing the TagSpecifications
correctly, because I can see the tags being applied to the resources when the launch template is used, but I want to tag the template itself, too.
I tried adding a Tags
field to the JSON description of the launch template, that gave an error.
The docs suggest using a TagSpecification
object like so:
{
"ResourceType": "launch-template",
"Tags": [
{
"Key": "mykey",
"Value": "myvalue"
}
]
}
... (note the "launch-template" resource type) which runs just fine without erring, but the template gets created without any tags :-/
I could run some follow-up tagging statements, but I'm trying to avoid doing that, and this article suggests it's doable at creation-time.