Steampipe : Powerful SQL Queries for Cloud

Reading Time: 2 minutes

Steampipe is a powerful SQL query engine that is perfect at pulling data from your cloud platform. If it has an API, it can be queried by Steampipe.

Install Steampipe: macOS with Brew

We recommend installing Homebrew which provides pre-built binaries for Mac.

STEP 1: Tap Turbot’s Cask

~$ brew tap turbot/tap

STEP 2: Install Steampipe

~$ brew install steampipe

STEP 3: Version Check

~$ steampipe -v steampipe version 0.10.0

STEP 4: Install the AWS plugin

~$ steampipe plugin install aws

Installed plugin: AWS

STEP 5: Configure your profile and SSO access

Important – You will need to re-configure after for SSO token expires – usually 24hrs

From the terminal type:

aws configure sso

SSO start URL [None]: https://<your-url>.awsapps.com/start#/

SSO Region [None]: eu-west-1

This will open your browser, click Allow Access

STEP 6: Select the account you want to use

There are 9 AWS accounts available to you.

< YOUR AWS ACCOUNT DETAILS>

STEP 7: Select the permissions you want>

AdminUser

PowerUser

ReadOnly

STEP 8: Give your profile a name – make it simple

CLI default client Region [eu-west-1]:

CLI default output format [text]:

CLI profile name [AdminUser-xxxxxx]: richard

STEP 9: Edit the steampipes config file

nano ~/.steampipe/config/aws.spc

It should look similar to this:

connection "aws" { plugin = "aws" regions = ["eu-west-1"] profile = "richard"

STEP 10: Start Steampipe

steampipe query

Explore

Steampipe provides commands that allow you to discover and explore the tables and data without leaving the query shell. (Of course this information is all available in the hub if online docs are more your speed…)

Let’s fire up Steampipe! Run 

steampipe query 

to open an interactive query session:

$ steampipe query

Welcome to Steampipe v0.5.0

For more information, type .help>

Now run the .tables meta-command to list the available tables:

steampipe, Steampipe : Powerful SQL Queries for Cloud

As you can see, there are quite a few tables available in the aws plugin!

It looks like there’s an aws_iam_role table – let’s run .inspect to see what’s in that table:

.inspect aws_iam_role

steampipe, Steampipe : Powerful SQL Queries for Cloud

History

The query shell supports command history, allowing you to retrieve, run, and edit previous commands. The command history works like typical unix shell command history, and persists across query sessions. When on a new line, you can cycle back through the history with the Up Arrow or Ctrl+p and forward with Down Arrow or Ctrl+n.

Key bindings

The query shell supports standard emacs-style key bindings:

KeysDescription
KeysDescription
Ctrl+aMove the cursor to the beginning of the line
Ctrl+eMove the cursor to the end of the line
Ctrl+fMove the cursor forward 1 character
Ctrl+bMove the cursor backward 1 character
Ctrl+wDelete a word backwards
Ctrl-dDelete a character forwards. On a blank line, Ctrl-d will exit the console
BackspaceDelete a character backwards
Ctrl+pUp ArrowGo to the previous command in your history
Ctrl+nDown ArrowGo to the next command in your history

How do you update Steampipe?

UPDATE STEP 1: Update Homebrew

~$ brew update

UPDATE STEP 2: Update Steampipe

~$ brew upgrade steampipe

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *