Tagging EC2 Instances
Sometimes there are specific business requirements to be able to add metadata to EC2 instances. To meet such requirements, the AWS cloud controller facilitates adding custom tags
to the instances upon launch.
Tags can be specified via the launch configuration schema. The launch configuration has two types of arbitrary data holders – properties
and metadata
. Tag data must be specified using metadata
attribute.
The aws cloud controller automatically specifes a few tags
by default to new instances. Those tags are :
identifier
:The instance identifier generated by the controllerrole
:The instance roleconnectionCapacity
:The instance’s assumed capacity as specifed in the launch configuration
Example:
{
"launchconfig": {
"name": "default-v2",
"description": "This is a sample launch configuration for demonstrating the aws tagging",
"image": "{red5pro-ami}",
"version": "0.0.2",
"targets": {
"target": [
{
"role": "origin",
"instanceType": "t2.micro",
"connectionCapacity": "2000"
},
{
"role": "edge",
"instanceType": "t2.micro",
"connectionCapacity": "2000"
}
]
},
"properties": {
"property": [
]
},
"metadata": {
"meta": [
{
"key": "environment",
"value": "production"
}
]
}
}
}
Tags can then be viewed from the EC2 console, under the Tags
tab. More information it is advised that you refer the AWS documentation on Ec2 tags https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html.