0.5.0 • Published 6 months ago

@infrascan/sdk v0.5.0

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
6 months ago

@infrascan/sdk

The Infrascan SDK allows you to scan your AWS accounts and graph the downloaded state. Most uses should use the CLI. The SDK is designed to allow self-hosting, alternate connectors, or to include custom scanners.

The SDK exposes two functions, performScan and generateGraph which are designed to be composed.

Quickstart

import Infrascan from "@infrascan/sdk";
import buildFsConnector from "@infrascan/fs-connector";
import { registerAwsScanners } from "@infrascan/aws";
import { serializeGraph } from "@infrascan/cytoscape-serializer";
import { reducerPluginFactory } from "@infrascan/node-reducer-plugin";
import { fromIni } from "@aws-sdk/credential-providers";

const credentials = fromIni({ profile: "dev" });
const regions = ["us-east-1", "us-west-1"];

const connector = buildFsConnector("state");
// Initialize the Infrascan client with all available services
const infrascan = registerAwsScanners(new Infrascan());

// Optionally register a plugin to mutate the graph
infrascan.registerPlugin(
  reducerPluginFactory([
    {
      // Collapse serverless deployment buckets into a single node
      id: "serverless-bucket-reducer",
      regex: /^(.+)(serverlessdeploymentbuck)(.*)$/,
      service: "s3",
    },
  ]),
);

infrascan
  .performScan(credentials, connector, { regions })
  .then(function (scanMetadata) {
    console.log("Scan Complete!", scanMetadata);
    return infrascan.generateGraph(scanMetadata, connector, serializeGraph);
  })
  .then(function (graphData) {
    console.log("Graph generated!");
  })
  .catch(function (err) {
    console.error("Failed to scan", err);
  });
0.5.0

6 months ago

0.4.2

1 year ago

0.4.1

1 year ago

0.4.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.1.0

2 years ago