steampipe plugin install ipstack

ipstack + Steampipe

ipstack provides IP to geolocation APIs and global IP database services.

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

For example:

select
ip,
country_code,
region_name,
latitude
from
ipstack_ip
where
ip = '99.84.45.75';
+-------------+--------------+-------------+--------------------+
| ip | country_code | region_name | latitude |
+-------------+--------------+-------------+--------------------+
| 99.84.45.75 | US | New Jersey | 40.738731384277344 |
+-------------+--------------+-------------+--------------------+

Documentation

Get started

Install

Download and install the latest ipstack plugin:

steampipe plugin install ipstack

Credentials

ipstack requires an API token for all requests, but offers a free tier. Sign up on the ipstack website to get your free token. It looks like e0067f483763d6132d549234f8a6de22.

Configuration

Connection configurations are defined using HCL in one or more Steampipe config files. Steampipe will load ALL configuration files from ~/.steampipe/config that have a .spc extension. A config file may contain multiple connections.

Installing the latest ipstack plugin will create a default connection named ipstack in the ~/.steampipe/config/ipstack.spc file. You must edit this connection to include your API token:

connection "ipstack" {
plugin = "ipstack"
token = "e0067f483763d6132d934864f8a6de22"
}

ipstack restricts HTTPS access and security data to subscribers. To enable:

connection "ipstack" {
plugin = "ipstack"
token = "e0067f483763d6132d934864f8a6de22"
https = true
security = true
}

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- ipstack

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_ipstack;
CREATE SERVER steampipe_ipstack FOREIGN DATA WRAPPER steampipe_postgres_ipstack OPTIONS (config '<your_config>');
CREATE SCHEMA ipstack;
IMPORT FOREIGN SCHEMA ipstack FROM SERVER steampipe_ipstack INTO ipstack;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- ipstack

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_ipstack function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_ipstack.so
sqlite> select steampipe_configure_ipstack('<your_config>');

Export

This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- ipstack

You can pass the configuration to the command with the --config argument:

steampipe_export_ipstack --config '<your_config>' <table_name>