Relabelling Example

If you put the name of your service in the EC2 Name tag (that's the value that shows up as the EC2 instance name in the UI), you could copy that into the job label using relabelling:

relabel_configs:
- source_labels: ["__meta_ec2_tag_Name"]
  regex: "(.*)"
  action: replace
  replacement: "${1}"
  target_label: "job"


As label copying is very common in relabelling, the defaults reduce this down to two lines:

relabel_configs:
- source_labels: ["__meta_ec2_tag_Name"]
  target_label: "job"