How To

Add context to your cloud multi-account reports

Custom names and tags make benchmark results easier to read, filter, and organize.

Steampipe Team
4 min. read - Mar 24, 2023

When you run a mod like AWS Thrifty, which finds ways to trim your AWS costs, Steampipe runs a set of controls. Each control in turn wraps a SQL query that returns at least three columns: status, reason, and resource.

These queries can also return extra columns, called dimensions, that add context to benchmark reports. For mods associated with AWS, useful dimensions include account_id and region; these help you track down, for example, where you're running EC2 instances that could be upgraded to newer and less costly instance types. You could always add dimensions yourself, but that required you to rewrite the mod's queries. Now, for dimensions that apply to any query in a mod, you can define them in mod variables.

Resource tags

You can now also add resource tags to your your reports, to help filter and group control outputs. Use them in cost-savings reports, for example, to segment controls by application team or cost center. To enrich your reports with resource tags for Cost Center, Owner and Environment, you can pass these tag names to the Steampipe CLI command steampipe check.

steampipe check control.ec2_instance_older_generation --var='tag_dimensions=["Cost Center", "Owner", "Environment"]'

Or if running in Steampipe Cloud, you can adjust the mod settings there.

Steampipe tag dimensions variable

Either way, the tag values will now appear in the control ouput.

Steampipe tag dimensions output in Steampipe Cloud

When you export your results to CSV, JSON or other supported outputs, the tags are included and you can use them to filter and group the data.

Connection names

If you are aggregating connections you might want to see the connection_name in addition to acount_id and region. These aliases can provide more context when managing multiple accounts, and help distinguish which account_id corresponds to which workload.

We can extend the prior CLI command like so.

steampipe check control.ec2_instance_older_generation --var='tag_dimensions=["Cost Center", "Owner", "Environment"]' --var='common_dimensions=["region","account_id","connection_name"]'

Or if in Steampipe Cloud, you can again adjust in the mod settings directly.

Steampipe common dimensions variable

Here's a sample result.

Steampipe common dimensions output in Steampipe Cloud

It's all about context

When you run cross-account and cross-region benchmarks, it's helpful to contextualize the results. The added dimensions discussed here are available not only for AWS Thrifty but also for many of the other mods as well.

If you have questions about common_dimensions and tag_dimensions, or thoughts about other ways to contextualize control outputs, our Slack community is the place to share them.