session

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package session manages SSM session lifecycle and shell/exec/forward modes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, cfg aws.Config, instanceID, region, profile string) error

Connect starts an interactive SSM session on instanceID by exec-ing session-manager-plugin. Only returns if an error occurs before exec.

func Exec

func Exec(ctx context.Context, cfg aws.Config, instanceID, region, profile, command string) error

Exec starts a non-interactive SSM session that runs command on instanceID, streaming output through session-manager-plugin. The context may carry a deadline (e.g. from --timeout); cancellation kills the plugin process.

func Forward

func Forward(ctx context.Context, cfg aws.Config, instanceID, region, profile string, fwd ForwardSpec) error

Forward starts a native SSM port-forwarding session via session-manager-plugin. It blocks until the plugin exits. The caller is responsible for running multiple forwards concurrently when needed.

func SSHProxy

func SSHProxy(ctx context.Context, cfg aws.Config, instanceID, region, profile string) error

SSHProxy starts an AWS-StartSSHSession over session-manager-plugin, piping stdin/stdout as the SSH transport. Used as the backend for the --proxy ProxyCommand so standard SSH tools (scp, rsync, ssh) work over SSM.

Types

type ForwardSpec

type ForwardSpec struct {
	LocalPort  string
	RemoteHost string
	RemotePort string
}

ForwardSpec describes a single port-forwarding rule.

func (ForwardSpec) IsLocal

func (f ForwardSpec) IsLocal() bool

IsLocal reports whether the forward targets the instance itself (remoteHost is localhost or 127.0.0.1), selecting AWS-StartPortForwardingSession instead of AWS-StartPortForwardingSessionToRemoteHost.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL