ipinfo.io + Steampipe
ipinfo.io is an API for IP address information (e.g. location).
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
Query your own IP:
select ip, city, country_namefrom ipinfo_ip;
+---------+---------+---------------+| ip | city | country_name |+---------+---------+---------------+| 1.2.3.4 | Chicago | United States |+---------+---------+---------------+
Or query any IP:
select ip, city, country_namefrom ipinfo_ipwhere ip = '8.8.8.8';
+---------+---------------+---------------+| ip | city | country_name |+---------+---------------+---------------+| 8.8.8.8 | Mountain View | United States |+---------+---------------+---------------+
Documentation
Get started
Install
Download and install the latest ipinfo.io plugin:
steampipe plugin install ipinfo
Configuration
Installing the latest ipinfo plugin will create a config file (~/.steampipe/config/ipinfo.spc
) with a single connection named ipinfo
:
connection "ipinfo" { plugin = "ipinfo"
# Optional: Set your access token # No token is needed for basic info requests. For # higher limits and more data a token is required. # token = "4692efda8b2b56"}
token
- Optional access token from ipinfo.io.
Environment variables are also available as an alternate configuration method:
IPINFO_TOKEN
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)" -- ipinfo
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_ipinfo;CREATE SERVER steampipe_ipinfo FOREIGN DATA WRAPPER steampipe_postgres_ipinfo OPTIONS (config '<your_config>');CREATE SCHEMA ipinfo;IMPORT FOREIGN SCHEMA ipinfo FROM SERVER steampipe_ipinfo INTO ipinfo;
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)" -- ipinfo
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_ipinfo
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_ipinfo.sosqlite> select steampipe_configure_ipinfo('<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)" -- ipinfo
You can pass the configuration to the command with the --config
argument:
steampipe_export_ipinfo --config '<your_config>' <table_name>