diff --git a/discovery/ec2/ec2.go b/discovery/ec2/ec2.go index 1fdb9cc4e..8d94a0c65 100644 --- a/discovery/ec2/ec2.go +++ b/discovery/ec2/ec2.go @@ -38,6 +38,7 @@ import ( const ( ec2Label = model.MetaLabelPrefix + "ec2_" + ec2LabelAMI = ec2Label + "ami" ec2LabelAZ = ec2Label + "availability_zone" ec2LabelArch = ec2Label + "architecture" ec2LabelInstanceID = ec2Label + "instance_id" @@ -212,6 +213,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) { labels[ec2LabelPublicDNS] = model.LabelValue(*inst.PublicDnsName) } + labels[ec2LabelAMI] = model.LabelValue(*inst.ImageId) labels[ec2LabelAZ] = model.LabelValue(*inst.Placement.AvailabilityZone) labels[ec2LabelInstanceState] = model.LabelValue(*inst.State.Name) labels[ec2LabelInstanceType] = model.LabelValue(*inst.InstanceType) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index a972b2492..7945fa49a 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -426,6 +426,7 @@ the public IP address with relabeling. The following meta labels are available on targets during [relabeling](#relabel_config): +* `__meta_ec2_ami`: the EC2 Amazon Machine Image * `__meta_ec2_architecture`: the architecture of the instance * `__meta_ec2_availability_zone`: the availability zone in which the instance is running * `__meta_ec2_instance_id`: the EC2 instance ID