We have a Prometheus setup in EC2. We are trying to build an alerting pipeline around it.
Our requirement is to keep the rule files in Github, somehow push those files to the prometheus instance on merge to main branch and do a sysctl reload prometheus on the EC2 to reload configs without restart.
Seems easy enough if we have SSH available. But unfortunately, we are using SSM only strictly and don't even attach an SSH key to most EC2. So SSH/SCP can't be used.
We have couple of options that we know of:
- Push the rule files to an S3 bucket from the Github pipeline and mount the bucket at
/etc/prometheus path. For reload, use the prometheus API endpoint.
- Use CodeDeploy. On every merge to main, create a revision and then deploy from the CodeDeploy console.
CodeDeploy model seems like an overkill (and additional steps involved to update some rules). Is S3 mount a good approach for this? Or does SSM itself provide some way to do this?