Add private EC2 + SSM reverse-tunnel port-forwarding demo - #19
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Add private EC2 + SSM reverse-tunnel port-forwarding demo#19devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A minimal, self-contained demo (
demos/ssm-private-ec2-port-forwarding/) that shows how to SSH into an EC2 instance with no public IP, no IGW route, and no NAT — reachable only through the SSM agent's outbound "reverse tunnel."The instance registers with SSM over interface VPC endpoints (
ssm,ssmmessages,ec2messages). We then useaws ssm start-session --document-name AWS-StartPortForwardingSessionto forward a local port to:22andsshback down that same tunnel. The security group opens no inbound SSH (only 443 from within the VPC for the endpoints), and the route table has only thelocalroute.Why endpoints instead of an IGW: an instance with no public IP can't reach the internet via an IGW (that needs a public IP or a NAT), so interface endpoints keep it fully private while SSM still works — which is what showcases the reverse tunnel.
Contents
provision.shEC2-SSM-InstanceProfileif absent). Polls until SSMPingStatus=Online.connect.shsshthrough it:./connect.sh 'hostname && id'or interactive.teardown.shProject=ssm-portfwd-demo.Usage:
Verified live
Provisioned end-to-end in
us-east-2and ranconnect.shagainst it:10.0.1.x),public-ipv4metadata returned 404Non-secret resource IDs are written to a git-ignored
.demo-state; the SSH key is generated under~/.ssh/and never committed.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/1e4fab88782f4400942ce831029d2cd6
Requested by: @bsmitches