[Unit] Description=Prometheus StartLimitBurst=5 StartLimitIntervalSec=300 [Service] Type=exec ExecStart=bash -c 'EC2_INSTANCE_ID="$(curl -fsSL http://169.254.169.254/latest/meta-data/instance-id)" prometheus --config.file /etc/prometheus/config.yaml --enable-feature=expand-external-labels' Restart=always RestartSec=5 [Install] WantedBy=multi-user.target