npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fusiontechsolution.ai/eks-tunnel

v0.1.3

Published

CLI tool to establish SSM port-forwarding tunnels to private EKS clusters through bastion hosts

Readme

eks-tunnel

A globally-installable CLI tool that establishes SSM port-forwarding tunnels to private EKS clusters through bastion hosts. One command to connect, kubectl is ready.

npm install -g @fusiontechsolution.ai/eks-tunnel
eks-tunnel connect my-cluster

Features

  • One-command connect — handles credentials, endpoint discovery, SSM tunneling, and kubectl config
  • Pluggable auth — supports AWS SSO, static IAM credentials, and external providers
  • Multiple tunnels — connect to several clusters simultaneously on different local ports
  • Watch mode — auto-reconnects dropped tunnels with credential refresh
  • Cross-platform — macOS and Ubuntu/WSL
  • Scriptable--json and --quiet flags for automation, structured exit codes

Prerequisites

| Tool | macOS | Linux | |------|-------|-------| | AWS CLI v2 | brew install awscli | Install guide | | kubectl | brew install kubectl | sudo apt-get install -y kubectl | | session-manager-plugin | brew install --cask session-manager-plugin | Install guide | | jq | brew install jq | sudo apt-get install -y jq |

Quick Start

# Install globally
npm install -g @fusiontechsolution.ai/eks-tunnel

# Create a starter config
eks-tunnel init

# Edit ~/.eks-tunnel/clusters.json with your cluster details
# Then connect:
eks-tunnel connect eu-west-1-my-cluster

Configuration

The cluster registry lives at ~/.eks-tunnel/clusters.json (override with --config or EKS_TUNNEL_CONFIG env var):

{
  "accounts": [
    {
      "accountId": "123456789012",
      "accountName": "my-production",
      "profile": "my-aws-profile",
      "authMethod": "sso",
      "clusters": [
        {
          "name": "eu-west-1-my-cluster",
          "bastionInstanceId": "i-0abc123def456",
          "region": "eu-west-1"
        }
      ]
    }
  ]
}

Auth Methods

| Method | authMethod value | Behavior | |--------|-------------------|----------| | AWS SSO | "sso" (default) | Uses profile SSO session; prompts aws sso login on expiry | | Static IAM | "iam" | Uses credentials from ~/.aws/credentials | | External provider | "provider" | Runs a configured command to refresh credentials |

External provider example:

{
  "authMethod": "provider",
  "providerConfig": {
    "command": "my-security-tool",
    "args": ["iam-roles:start", "--id", "role-uuid", "--profileName", "my-profile"]
  }
}

Commands

connect

eks-tunnel connect [cluster-name] [options]

Options:
  -c, --config <path>   Path to cluster registry config
  -p, --port <number>   Local port (default: auto from 8443)
  --json                Output as JSON
  --quiet               Suppress progress messages
  --skip-prereqs        Skip prerequisite checks
  --watch               Enter watch mode after connecting

status

eks-tunnel status [--json]

Lists active tunnels with cluster name, account, region, port, PID, and uptime.

stop / stop-all

eks-tunnel stop <cluster-name>   # Stop one tunnel
eks-tunnel stop-all              # Stop all tunnels

Terminates the SSM process, removes the kubeconfig context, and cleans state.

watch

eks-tunnel watch <cluster-name>

Monitors an active tunnel every 30s. Auto-reconnects on failure (up to 3 retries).

refresh

eks-tunnel refresh <cluster-name>

Proactively refreshes credentials for the cluster's account.

init

eks-tunnel init

Creates a starter ~/.eks-tunnel/clusters.json with placeholder values.

Exit Codes

| Code | Meaning | |------|---------| | 0 | Success | | 1 | General error (config missing, parse error, no match) | | 2 | Missing dependency | | 3 | Authentication failure | | 4 | Tunnel timeout | | 5 | Connection verification failed |

Development

# Install dependencies
npm install

# Build
npm run build

# Run all tests
npm test

# Run property-based tests only
npm run test:property

Project Structure

src/
├── cli.ts                     # Commander.js entry point
├── types.ts                   # Shared interfaces
├── errors.ts                  # ExitError class
├── constants.ts               # Exit codes, defaults
└── modules/
    ├── auth/                  # SSO, IAM, external providers
    ├── platform-detector.ts
    ├── prerequisite-checker.ts
    ├── registry-loader.ts
    ├── cluster-resolver.ts
    ├── region-inferrer.ts
    ├── endpoint-discoverer.ts
    ├── port-assigner.ts
    ├── tunnel-establisher.ts
    ├── kubeconfig-configurator.ts
    ├── connection-verifier.ts
    ├── state-manager.ts
    └── output-formatter.ts

tests/
├── unit/                      # Example-based unit tests
└── property/                  # Property-based tests (fast-check)

How It Works

  1. Verifies prerequisites (aws, kubectl, session-manager-plugin, jq)
  2. Loads and validates the cluster registry
  3. Resolves the cluster (exact match, substring, or interactive selection)
  4. Infers the AWS region from the cluster name or config
  5. Discovers the EKS API endpoint via aws eks describe-cluster
  6. Assigns a free local port (starting at 8443)
  7. Establishes an SSM port-forwarding session through the bastion
  8. Configures kubectl with a context pointing to localhost:<port>
  9. Verifies connectivity with kubectl get nodes

License

MIT

Changelog

See CHANGELOG.md for a full list of changes per version.

Release notes for each version are available in docs/releases/.