The aws-ec2 mixed provider lists running EC2 instances with the AWS SDK for Go and returns them as dynamic server entries.
It also exposes AWS connector contracts for those instances.
This README describes the current mixed implementation.
Planned direction:
- plugin name
provider-mixed-aws-ec2
- provider categories
inventoryconnector
- connector backend
- AWS SSM
- later connector modes may also include direct SSH or bastion-backed SSH flows
[providers]
paths = ["~/.config/lssh/providers/provider-mixed-aws-ec2"]
max_parallel = 4
[provider.aws]
plugin = "provider-mixed-aws-ec2"
enabled = true
capabilities = ["inventory", "connector"]
regions = ["ap-northeast-1"]
profile = "default"
shared_config_files = ["~/.aws/config"]
shared_credentials_files = ["~/.aws/credentials"]
addr_strategy = "public_first"
server_name_template = "aws:${tags.Name}"
note_template = "aws ${instance_id} ${private_ip}"
ssm_require_online = true
[provider.aws.match.web]
meta_in = ["tag.Role=web", "region=ap-northeast-1"]
connector_name = "ssh"
user = "ec2-user"
key = "~/.ssh/aws-web.pem"
[provider.aws.match.ssm_plugin]
meta_in = ["tag.Connection=ssm-plugin"]
connector_name = "aws-ssm"
ssm_shell_runtime = "plugin"
ssm_port_forward_runtime = "plugin"
[provider.aws.match.eice_sdk]
meta_in = ["tag.Connection=eice-sdk"]
connector_name = "aws-eice"
eice_runtime = "sdk"
instance_connect_endpoint_id = "eice-0123456789abcdef0"
private_ip_address = "10.0.1.10"
user = "ec2-user"
key = "~/.ssh/aws-eice.pem"
[provider.aws.match.eice_command]
meta_in = ["tag.Connection=eice-command"]
connector_name = "aws-eice"
eice_runtime = "command"
instance_connect_endpoint_dns_name = "eice-demo.ap-northeast-1.aws"
private_ip_address = "10.0.2.10"
user = "ec2-user"
key = "~/.ssh/aws-eice.pem"providers.pathsis intended to list provider executable files.providers.max_parallellimits how many inventory providers are queried at the same time.- unset or
0means no explicit limit - inventory fetch is parallel, but merge order stays deterministic by provider order
- unset or
- current plugin capabilities are
["inventory", "connector"]. plugin.describereports connector namesaws-ssmandaws-eice.- inventory is implemented by
inventory.list. - connector is currently implemented by
connector.describeandconnector.prepare. - Uses the AWS SDK default credential/config chain.
profile,shared_config_files, andshared_credentials_filescan be used to steer authentication.addr_strategycontrols how generatedaddris chosen.private_first(default)public_firstprivate_onlypublic_only
- Only running instances are returned.
matchcan override SSH settings per generated host, includingconnector_name.connector_name = "ssh"forces the built-in go-sshlib path instead of the provider connector.default_connector_namecan be used to select the provider connector whenmatch.connector_nameis omitted.- set
default_connector_name = "aws-ssm"to preserve previous single-connector behavior
- set
- when
aws-ssmandaws-eicehosts are mixed, prefer settingconnector_nameand runtime keys on each server ormatchentry. - Available match metadata includes
region,zone,platform,instance_id,private_ip,public_ip, andtag.<TagName>. connector.describerequires connector-specific metadata emitted by this inventory provider.aws-ssmandaws-eiceeach implementconnector.describeandconnector.prepare.- future AWS connector expansion may include:
- direct SSH
- bastion-backed SSH
- OpenSSH-transport-based file operations layered in Go
- for
shell, attach/detach are represented as operation options rather than separate subcommands.attach=truewithsession_id=<id>resumes an existing SSM sessiondetach=truestarts a shell session without attaching and returns a session idattachanddetachare mutually exclusive
ssm_require_onlinedefaults totrue.- when enabled, the connector requires the target instance to be online in AWS Systems Manager
health.checkis scope-aware.- default mixed-provider behavior validates both EC2 inventory access and the SSM connector path
- set
capabilities = ["inventory"]to validate only the inventory side - set
connector_names = ["aws-ssm"]when you want the health check to include the SSM connector explicitly
ssm_shell_runtimecontrols howshellis executed.plugin(default): useaws ssm start-sessionnative: use the experimental built-in Go runtime for plain shell startlocalrcis supported only in this mode
ssm_port_forward_runtimecontrols how local port forwarding is executed.- if omitted, it follows
ssm_shell_runtime plugin: useaws ssm start-sessionwith the port forwarding documentnative: use the experimental built-in Go runtime for local and dynamic forwarding
- if omitted, it follows
- optional connector tuning keys:
ssm_shell_documentssm_interactive_command_documentssm_port_forward_documentinstance_connect_endpoint_idinstance_connect_endpoint_dns_nameprivate_ip_addresseice_runtime
- current runtime behavior:
shellis executed withaws ssm start-session- attach uses
aws ssm resume-session - detach uses the AWS SDK
StartSessionAPI and returns the created session id
- attach uses
shellwithssm_shell_runtime = "native"currently supports only a plain start session- attach/detach still use the plugin runtime
localrcis executed by sending the generated startup command through the native session
execis executed with the AWS SDK viaSendCommand- when
ssm_shell_runtime = "native"and the caller uses the connector stream path,lspipe --rawcan stream stdin/stdout over the native runtime for Linux targets
- when
port_forward_localsupports bothpluginandnativelssh -L ...works forconnector_name = "aws-ssm"hosts- only one TCP local forward is supported in the first wave
- bind address must stay on localhost / loopback
- AWS SSM runs this as a forwarding-only session, so
-Nandlocalrcare ignored - in
nativemode, each accepted local TCP connection uses its own SSM session - X11 forwarding is still unsupported
- dynamic port forwarding (
lssh -D ...) supports bothpluginandnative- implemented as a local SOCKS5 listener plus one SSM port forwarding session per SOCKS connection
- when
lsshis used in shell mode,-Dkeeps the interactive shell open unless-Nis specified - current
nativemode uses the AWS CLI/session-manager-plugin transport for each SOCKS connection while the built-in port-session path catches up with newer agent behavior - only SOCKS5 CONNECT without authentication is supported in the first wave
- HTTP dynamic port forwarding (
lssh -d ...) supports bothpluginandnative- implemented as a local HTTP proxy listener plus one SSM port forwarding session per request
- when
lsshis used in shell mode,-dkeeps the interactive shell open unless-Nis specified - current
nativemode uses the AWS CLI/session-manager-plugin transport for each HTTP proxy request - ordinary HTTP requests and HTTPS
CONNECTare supported in the first wave
- reverse / HTTP reverse / NFS / SMB forwarding still return explicit unsupported errors for
aws-ssm
- to use
shell, the local machine must have:- AWS CLI
- Session Manager plugin for AWS CLI
connector_name = "aws-eice"enables EC2 Instance Connect Endpoint transport.eice_runtimecontrols the connector runtime.sdk(default): provider-managed SSH transport for shell, exec, SFTP, mount, and local forwardingcommand: OpenSSHProxyCommandusingaws ec2-instance-connect open-tunnel
aws-eicerequires:instance_idregion- one of
instance_connect_endpoint_idorinstance_connect_endpoint_dns_name - target private address information, typically
private_ip_address
Per-server example:
[provider.aws.match.eice_sdk]
meta_in = ["tag.Connection=eice-sdk"]
connector_name = "aws-eice"
eice_runtime = "sdk"
instance_connect_endpoint_id = "eice-0123456789abcdef0"
private_ip_address = "10.0.1.10"
user = "ec2-user"
key = "~/.ssh/aws-eice.pem"
[provider.aws.match.eice_command]
meta_in = ["tag.Connection=eice-command"]
connector_name = "aws-eice"
eice_runtime = "command"
instance_connect_endpoint_dns_name = "eice-demo.ap-northeast-1.aws"
private_ip_address = "10.0.2.10"
user = "ec2-user"
key = "~/.ssh/aws-eice.pem"See example/provider-aws-eice.toml.
Example stream transfer with lspipe:
tar czf - ./dist | lspipe -h aws:ssm-host --raw 'tar xzf - -C /srv/app'
lspipe -h aws:ssm-host --raw 'tar czf - /srv/app' > app.tar.gzThe AWS SSM connector consumes inventory metadata from this provider rather than rediscovering instance identity.
Recommended connector-facing metadata:
instance_idregionzoneprivate_ippublic_iptag.Nametag.<TagName>
Current operation capabilities for the AWS SSM connector layer:
shellexecexec_ptyport_forward_local- internal
tcp_dial_transportused by dynamic forwarding
Not recommended for the first implementation wave:
uploaddownloadmount
Those can be designed later if there is a clear, native AWS SSM transfer model worth exposing.