steampipe plugin install fastly

Fastly + Steampipe

Fastly provides an edge cloud platform, including content delivery network (CDN), image optimization, video and streaming, cloud security, and load balancing services.

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

List your Fastly domains:

select
name,
service_id,
service_version,
comment,
created_at,
updated_at
from
fastly_service_domain;
+----------------+------------------------+-----------------+---------+---------------------------+---------------------------+
| name | service_id | service_version | comment | created_at | updated_at |
+----------------+------------------------+-----------------+---------+---------------------------+---------------------------+
| testnumbe3.com | FxvqNlNxUKWRWrioX313Q6 | 4 | <null> | 2023-04-18T21:58:07+05:30 | 2023-04-19T15:42:19+05:30 |
+----------------+------------------------+-----------------+---------+---------------------------+---------------------------+

Documentation

Quick start

Install

Download and install the latest Fastly plugin:

steampipe plugin install fastly

Credentials

ItemDescription
CredentialsFastly requires an API Key and Service ID for all requests.
PermissionsThe permission scope of API Keys is set by the Admin at the creation time of the API tokens.
RadiusEach connection represents a single Fastly Installation.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/fastly.spc)
2. Credentials specified in environment variables, e.g., FASTLY_API_KEY and FASTLY_SERVICE_ID.

Configuration

Installing the latest fastly plugin will create a config file (~/.steampipe/config/fastly.spc) with a single connection named fastly:

Configure your account details in ~/.steampipe/config/fastly.spc:

connection "fastly" {
plugin = "fastly"
# api_key - The fastly API token. Required.
# Get your API token from Fastly https://docs.fastly.com/en/guides/using-api-tokens
# Can also be set with the FASTLY_API_KEY environment variable.
# api_key = "cj9nU-sMOgUmo7FxcZ48tJsofuiVUhai"
# service_id - Each connection represents a single service in Fastly. Required.
# Can also be set with the FASTLY_SERVICE_ID environment variable.
# service_id = "2ctACCWV5PmZGadiS7Ft5T"
# base_url - The fastly base URL. By default plugin will use https://api.fastly.com. Optional.
# Can also be set with the FASTLY_API_URL environment variable.
# base_url = "https://api.fastly.com"
# service_version - The fastly service version. By default, the plugin will use the active version of the provided service; if no active version is available, then the plugin will use the latest version. Optional.
# Can also be set with the FASTLY_SERVICE_VERSION environment variable.
# service_version = "1"
}

Alternatively, you can also use the standard Fastly environment variables to obtain credentials only if the api_key,service_id, base_url and service_version are not specified in the connection:

export FASTLY_API_KEY=cj9nU-sMOgUmo7FxcZ48tJsofuiVUhai
export FASTLY_SERVICE_ID=2ctACCWV5PmZGadiS7Ft5T
export FASTLY_API_URL=https://api.fastly.com
export FASTLY_SERVICE_VERSION=1

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)" -- fastly

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_fastly;
CREATE SERVER steampipe_fastly FOREIGN DATA WRAPPER steampipe_postgres_fastly OPTIONS (config '<your_config>');
CREATE SCHEMA fastly;
IMPORT FOREIGN SCHEMA fastly FROM SERVER steampipe_fastly INTO fastly;

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)" -- fastly

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_fastly function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_fastly.so
sqlite> select steampipe_configure_fastly('<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)" -- fastly

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

steampipe_export_fastly --config '<your_config>' <table_name>