Puppet has announced the beta release of Relay, their event driven automation platform. Relay allows for automating processes as code. There are a number of pre-written workflows and there is support for creating additional workflows. Relay has a number of integrations available for use in workflows including AWS, Kubernetes, Azure, PagerDuty, and GitHub.
Relay is designed to automate both if-this-then-that style tasks as well as multi-step, branching, parallelized processes. This could be a task such as deleting an unused Azure disk or responding to a PagerDuty alert by creating the necessary tickets in Jira and opening a room in Slack.
Within a workflow there are triggers and steps. Triggers are event handlers that initialize workflow runs. Triggers can be activated manually, on a schedule, or via an external source. Steps are the parts of the automation workflow run by Relay. Parameters and secrets are passed in as part of the step run.
For example, Relay could be used to review EC2 instances and terminate any without a particular tag. In this workflow, any EC2 instance in a given account that is not tagged with a termination date or lifetime after 4 minutes, or has expired or invalid lifetime tags will be terminated. In this case, the workflow could be run on a schedule by setting the following trigger block using the appropriate cron style syntax:
triggers:
- name: schedule
source:
type: schedule
schedule: '0 * * * *'
binding:
parameters:
region: us-east-1
dryRun: true
lifetimeTag: lifetime
terminationDateTag: termination_date
Steps are containers allowing for each step to run in isolation and with flexibility. Any OCI-compliant container can be used. Adding the Relay tools in at build time will provide access to the metadata service. As an alternative, if the task can be written in a shell or Python script, the relaysh/core
image could be used. This image is an Alpine-based image that the Relay team maintains and is pre-loaded with the Relay SDK. There are relaysh/core:latest
and relaysh/core:latest-python
images available.
For example, setting up a step to execute a python script on the relaysh/core image would look like this:
steps:
- name: filter-instances
image: relaysh/core:latest-python
spec:
terminationDateTag: !Parameter terminationDateTag
lifetimeTag: !Parameter lifetimeTag
instances: !Output {from: describe-instances, name: instances}
inputFile: https://raw.githubusercontent.com/puppetlabs/relay-workflows/master/ec2-reaper/filter-instances.py
The spec
map defines keys and values that will be available within the step. The Relay !Parameter
type allows for looking up the value of a global parameter and provides it to the container. !Secret
can be used to access encrypted values. There are also utility functions such as !Merge
and !Concat
that allow for performing logic within the workflows.
There are a number of pre-made workflows that are available. Puppet is also looking for community contributions to improve Relay and extend with additional integrations. There is also a Slack channel available for further discussions regarding Relay.