This is just for fun. It's a simple SSH server and tunnel-er that allows you to SSH into a running lambda function—until it times out.
Developed for my dotScale 2017 talk, "Searching for the Server in Serverless". Slides here.
This project uses the Serverless Application Model for packaging and deploying.
$ sam build
$ sam package --s3-bucket <yourbucket> > packaged.yaml
$ sam deploy --template-file packaged.yaml --stack-name <yourstack> --capabilities CAPABILITY_IAM
faassh -i ./path_to_private_rsa_host_key -p port_number
See the example node.js lambda function in the lambda/
directory.
- Generate RSA keys for the Lambda function and bundle inside the
lambda
directory (ssh-keygen -t rsa -f ./id_rsa
) - Set the envionment variables to point to your SSH jump host with the correct username.
If you'd like to test it on your local laptop that's behind (hopefully) a NAT/firewall, I like the TCP forwarding available on ngrok. You can create a tunnel to your local SSH server for the other end of the tunnel endpoint, you just run: ngrok tcp 22
.
- lambdash - another approach for running commands in Lambda
- awslambdaproxy - An AWS Lambda powered HTTP/SOCKS web proxy
- better authentication support
- other cloud providers
- connection cleanup
- terraform/cloudformation helper
- multiple connections
- tests and docs :)