Jinja2 Templating Overview

Certain actions within the product have the ability to leverage Jinja2 templating in the message body. This enables Bot authors to insert a variety of useful data about resources into the message. As of this writing, the following actions contain support for this capability:

  • Send Delayed Email (see example messages)

  • Post Request To URL

  • Send Slack Message

  • Set Container Policy (see example policies)

When using these actions, you can access resource properties by using the following syntax:

{{resource.<attribute>}} or {{resource.<function>}}

Resource Attributes

Available attributes vary based on the resource type (E.g. instances). A listing of available attributes based on the resource type can be found by clicking the links below:

Compute Resources

Storage Resources

Network Resources

Identity & Management Resources


  • Availability Zone

  • DNS Zone Record

  • Memcache Instance

  • Resource Access List

  • Private Network

  • Service Alarm

  • Service User

  • Service Certificate

Resource Functions

A list of functions that you can use is listed below:


This walks the resource to the database object and returns the name. For resources which do not have a name, the primary key value is returned. With public IP addresses, for example, the resource’s IP address will be returned.



These walk the resource to the parent organization service (cloud account) to retrieve the name and account number assigned to the account (E.g. Acmecorp AWS Production and 123456789012)


TRiA has a concept of assigning ownership to one or more resources. Doing this not only grants full permission to that resource, but delegates a point of contact (POC) to reach out to for questions on the resource. This function will return the name of the POC if one is assigned, and None if one is not.


Calculate the daily cost for the resource in question. If the resource does not support cost calculation then this function will return None.


Calculate the monthly cost for the resource in question. If the resource does not support cost calculation then this function will return None.

{{resource.get_tag_value(tag_key, case_insensitive=True, default_return_str=None)}}

Get the value of a particular tag key. Only the tag key is required; however, you can optionally set the case_insensitive and default_return_str kwargs to force case sensitivity and/or return a specific value if the tag key does not exist.

Putting It All Together

Let’s take a look at a couple examples. Let’s configure an the Send Delayed Email notification to send an Email to the admin team when a new instance is provisioned. This will provide line of sight on any new resource that can impact the monthly bill. The image below shows how to add a customized message body for each new instace.


Next let’s configure the Slack notification to send a customized message when new volumes are provisioned. The message will contain the account name and availability zone where the volume resides.