Automation
The Automation Engine enables the creation of dynamic, event-based rules that automate the process of updating your catalog in response to changes, such as the addition of new entities via plugins or API integrations.
This automation framework is useful for maintaining a coherent and up-to-date view of your software ecosystem without the need for constant manual intervention.
Key Features
Event-Based Triggers: Automate actions in your catalog based on specific events, such as the creation or update of an entity through a plugin.
Rule-Based Actions: Configure actions to automatically insert or update entities based on the conditions specified in the automation rules.
Setting Up Automation Rules
Automation rules are defined through a trigger condition and a resulting action. These rules can be configured via the Rely.io user interface or directly through code, offering flexibility for both non-technical users and developers.
Trigger Condition
Trigger conditions specify the event that initiates an automation rule. Currently, the only trigger enabled is the creation or update of an entity from a specific plugin-generated blueprint. In the context of the automation flow, this is known as the source blueprint.
Actions
Actions define the operations to be performed when a trigger condition is met. The primary action currently available is the "upsert" operation, which updates an existing entity or inserts a new one based on the rule's logic. In the context of the automation flow, the blueprint of the entity to be created/updated is known as the target blueprint.
Update: If the conditions of the trigger are met and a resulting target entity already is found, the properties and relations of the target entity are updated according to what's defined in the automation rule.
Insert: If no target entity is found, a new entity is created with its attributes specified also according to the rule's definition.
Mapping Source to Target Entities
In order to be able to perform the "upsert" operation the automation rule needs to contain a way to map source entities to target ones.
This requires specifying certain aspects of the target entity—such as its metadata, properties, and relations—using the source entity's equivalent details as variables. The rule engine enables you to do this with the {{ ... }}
operator (checkout a real use-case in the next section).
By establishing this mapping, the automation rule seamlessly translates and aligns data between source and target entities.
Practical Example
Consider automating the management of cloud resources. When a new EC2 instance is detected through the AWS plugin, Rely automatically creates a corresponding "EC2" entity.
An automation rule can ensure that a corresponding "Resource" entity is created or updated, abstracting away the specifics of the EC2 instance into a more general resource entity.
Following this scenario, a possible way of creating the rule is with the following configuration.
Source Blueprint: AWS/EC2
Target Blueprint: Resource
Source to Target Mapping:
resource.id: "{{ ec2.id }}-ec2-resource"
resource.title: "{{ ec2.title }}"
resource.properties.cloud: "AWS"
resource.properties.type: "EC2"
resource.properties.region: "{{ ec2.region }}"
resource.properties.managment_console: "{{ ec2.dashboard_link }}"
This implies that upon detecting a new EC2 instance, a corresponding Resource entity will be automatically generated, populating the specified fields (id, title, cloud, type, region and management console) as outlined in the rule. Likewise, any updates made to these fields in the source entity will be mirrored in the associated Resource entity, ensuring consistency and accuracy across entities.
E.g. an EC2 identified as i-0c26a25210024d4dd
will be mapped to a resulting resource whose id will be i-0c26a25210024d4dd-ec2-resource
, its cloud
property set to "AWS", its type
property set to "EC2" and its region
and management console
properties configured to whatever is defined to the original entity's region
and dashboard_link
properties.
This automation rule can be represented as code with the following configuration.
Last updated