DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk6 min

How to SSH to a Private EC2 Instance via AWS Session Manager

Connect GitHub Actions to private EC2 without opening inbound port 22 by using OIDC for short-lived AWS credentials and Session Manager as the SSH transport.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can reach a private EC2 instance from GitHub Actions without allowing inbound SSH from GitHub-hosted runner IPs. Use GitHub’s OIDC integration to obtain short-lived AWS credentials, then route SSH through AWS Systems Manager Session Manager. The instance still needs SSH running, and the workflow still needs an SSH key and an operating-system username; Session Manager supplies the network path, not SSH authentication.

How the connection works

The workflow assumes a narrowly scoped AWS IAM role through GitHub’s OpenID Connect (OIDC) identity provider. It then uses the AWS CLI and Session Manager plugin to start a Session Manager session to the instance. SSH’s ProxyCommand sends the SSH connection through that session to the instance’s SSH service.

As an Amazon Associate I earn from qualifying purchases.

This avoids an inbound TCP port 22 connection from the runner to the instance, so this pattern does not require a security-group ingress rule for GitHub runner address ranges. It does not disable SSH on the instance: SSH must be running, and the client must authenticate as a valid OS user with the corresponding SSH key.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

GitHub’s AWS OIDC guide explains how workflows can access AWS without storing long-lived AWS credentials as GitHub secrets. AWS documents the SSH tunnel configuration in Allow and control permissions for SSH connections through Session Manager.

#1 Best Overall
Sale
TP-Link USB to Ethernet Adapter,Support Nintendo Switch,1Gbps,Plug and Play
  • 𝐇𝐢𝐠𝐡-𝐒𝐩𝐞𝐞𝐝 𝐔𝐒𝐁 𝐄𝐭𝐡𝐞𝐫𝐧𝐞𝐭 𝐀𝐝𝐚𝐩𝐭𝐞𝐫 - UE306 is a USB 3.0 Type-A to RJ45 Ethernet adapter that adds a reliable wired network port to your laptop, tablet, or Ultrabook. It delivers fast and stable 10/100/1000 Mbps wired connections to your computer or tablet via a router or network switch, making it ideal for file transfers, HD video streaming, online gaming, and video conferencing.
  • 𝐔𝐒𝐁 𝟑.𝟎 𝐟𝐨𝐫 𝐅𝐚𝐬𝐭𝐞𝐫, 𝐌𝐨𝐫𝐞 𝐒𝐭𝐚𝐛𝐥𝐞 𝐃𝐚𝐭𝐚 𝐓𝐫𝐚𝐧𝐬𝐟𝐞𝐫𝐬- Powered via USB 3.0, this adapter provides high-speed Gigabit Ethernet without the need for external power(10/100/1000Mbps). Backward compatible with USB 2.0/1.1, it ensures reliable performance across a wide range of devices.
  • 𝐒𝐮𝐩𝐩𝐨𝐫𝐭𝐬 𝐍𝐢𝐧𝐭𝐞𝐧𝐝𝐨 𝐒𝐰𝐢𝐭𝐜𝐡- Easily connect your Nintendo Switch to a wired network for faster downloads and a more stable online gaming experience compared to Wi-Fi.
  • 𝐏𝐥𝐮𝐠 𝐚𝐧𝐝 𝐏𝐥𝐚𝐲- No driver required for Nintendo Switch, Windows 11/10/8.1/8, and Linux. Simply connect and enjoy instant wired internet access without complicated setup.
  • 𝐁𝐫𝐨𝐚𝐝 𝐃𝐞𝐯𝐢𝐜𝐞 𝐂𝐨𝐦𝐩𝐚𝐭𝐢𝐛𝐢𝐥𝐢𝐭𝐲- Supports Nintendo Switch, PCs, laptops, Ultrabooks, tablets, and other USB-powered web devices; works with network equipment including modems, routers, and switches.

What you need before configuring the workflow

  • A GitHub OIDC trust relationship: An AWS IAM identity provider for GitHub and a role whose trust policy restricts which repository and branch, tag, or GitHub environment can assume it. For the official GitHub action, GitHub documents sts.amazonaws.com as the audience. Its guide warns that a condition is required to prevent untrusted repositories from requesting tokens.
  • An SSM-managed EC2 instance: The instance must be registered as a Systems Manager managed node, and it must have a network path to the Systems Manager endpoints. The specific instance role, subnet, endpoints, and egress depend on your AWS account architecture.
  • SSH configured on the instance: The SSH service must be listening on the port you intend to use. The OS account must accept the public key corresponding to the private key available to the workflow.
  • Tools on the runner: Install and configure the AWS CLI and the Session Manager plugin in the GitHub Actions runner environment. AWS lists client prerequisites in its Session Manager plugin installation guide. Check that guide for current installation instructions for your runner operating system.
  • Scoped IAM permissions: The role needs permission to start the intended session and identify its target. Limit permissions to the necessary Systems Manager actions, instance, and session document where the policy supports that scope; do not use broad wildcards as a production shortcut.

Configure GitHub OIDC access to AWS

  1. Register GitHub as an IAM OIDC identity provider. Follow GitHub’s AWS OIDC configuration guide. Use the audience required by the official action, sts.amazonaws.com.
  2. Create an IAM role with a restrictive trust policy. Add conditions that identify the intended GitHub repository and restrict the subject to the branch, tag, or GitHub environment permitted to deploy. Do not leave the trust relationship open to arbitrary repositories.
  3. Grant the role only the session permissions the workflow needs. Scope the Systems Manager permissions to the target instance and session document where supported. Review the AWS permissions guidance for Session Manager user permissions and adapt it to your intended operation.
  4. Configure the workflow to request an OIDC token. Grant the job the GitHub Actions id-token: write permission and use the AWS credential action documented by GitHub to assume the role. Keep deployment permissions limited to the job that needs them.

Set up SSH over Session Manager

  1. Install the AWS CLI and Session Manager plugin on the runner. Use AWS’s current installation steps for the runner platform, then verify both tools are available on the job’s PATH.
  2. Make the SSH private key available to the job securely. The matching public key must already be authorized for the chosen OS account on the instance. Do not print the private key or expose it in workflow logs.
  3. Add an SSH host configuration that invokes Session Manager. In the runner’s SSH configuration, use the EC2 instance ID as the host target and set a ProxyCommand like this:
Host i-0123456789abcdef0
  HostName i-0123456789abcdef0
  User ec2-user
  IdentityFile ~/.ssh/deploy_key
  ProxyCommand aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'

Replace the example instance ID, OS username, and key path with values for your environment. The command’s %h and %p substitutions pass the configured host and SSH port to aws ssm start-session. The AWS-StartSSHSession document starts the tunnel to the instance’s SSH service; it does not replace SSH key authentication.

  1. Connect using the configured host alias. Run ssh i-0123456789abcdef0 or use that alias as the host in your deployment command. SSH will invoke the ProxyCommand, which in turn starts the Session Manager session.
  2. Run the deployment command through SSH. Keep the command and any application-specific setup appropriate to your deployment. No inbound port 22 rule from the runner is needed for this route.

Choose SSH tunneling or port forwarding

These Session Manager options solve different problems. Choose SSH tunneling when the workflow needs an SSH session or commands on the EC2 host. Choose port forwarding when it needs a local TCP connection to a service on the managed node or a remote host. AWS explains port-forwarding behavior in its Session Manager session documentation and port-forwarding guidance.

Rank #2
Amazon Basics USB 3.0 to 10/100/1000 Gigabit Ethernet Internet Adapter, Compatible with Windows and macOS, Black
  • Connects a USB 3.0 device (computer/laptop) to a router, modem, or network switch to deliver Gigabit Ethernet to your network connection. Does not support Smart TV or gaming consoles (e.g.Nintendo Switch).
  • Supported features include Wake-on-LAN function, Green Ethernet & IEEE 802.3az-2010 (Energy Efficient Ethernet)
  • Supports IPv4/IPv6 pack Checksum Offload Engine (COE) to reduce Cental Processing Unit (CPU) loading
  • Compatible with Windows 8.1 or higher, Mac OS
Choice Use it for Target requirements Authentication and access Agent version noted by AWS
SSH through Session Manager SSH login and commands on the EC2 host SSM-managed node with SSH running IAM-authorized Session Manager session plus SSH OS-user and key authentication Not stated in the cited SSH guidance
Port forwarding to the managed node A local TCP connection to a service on the managed node SSM-managed node with the target service listening on the forwarded port IAM-authorized Session Manager tunnel; the application protocol may require its own authentication 2.3.672.0 minimum
Port forwarding to a remote host A local TCP connection through the managed node to a service on another host Managed node with network reachability to the remote host and its service IAM-authorized Session Manager tunnel; the application protocol may require its own authentication 3.1.1374.0 minimum

AWS specifies the listed minimum SSM Agent versions for Session Manager port forwarding in its session documentation. Those version requirements apply to the forwarding cases, not as a general SSH-over-Session-Manager requirement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a task that only needs to execute commands on an instance, Systems Manager Run Command may be a better fit than opening an SSH session. It is a separate Systems Manager operation with its own permission and execution model; choose it only after checking the requirements for your account and workflow.

Rank #3
USB A/C to Ethernet Adapter, 3xUSB3.0 and 1000M RJ45 Network hub for Laptop
  • [Expansion Ports] The USB C to Ethernet Adapter expands the device to three USB 3.0 ports and one Gigabit Ethernet port. Provides you more peripheral ports while maintaining a stable network connection, plug and play, no driver required.
  • [Gigabit Network Port] ALL-LUCKY USB Ethernet Adapter transmission rate up to 1000Mbps, also compatible with 10/100Mbps bandwidth. It allows you to enjoy a smooth and stable network connection and avoid too much lag. (Note: To reach 1Gbps, please use CAT6 or above Ethernet cable connection)
  • [Convertible Connector]This usb hub with ethernet not only has USB-A connector, but also can be converted to USB-C connector, so that you can easily convert the connector according to the device port, improve the convenience of use.
  • [High-Speed Data Transfer] The usb to ethernet adapter adopts USB 3.0 transmission technology, supports up to 5Gbps transmission rate, and is compatible with USB 2.0(480Gbps),USB 1.0(12Mbps), easily transfer video, files and other data for you in seconds. (Note: Maximum output current is 900mA, does not support charging devices.)
  • [Widely Compatible]The usb c ethernet adapter for iMac, MacBook Pro, iPad Pro, XPS and many other devices. Compatible with Windows 11/10/8.1/8, Mac OS, iPad OS, Chrome OS.(Note: Driver is required on Win 7) It can be used in office, school, library and other occasions, compact and portable, easy to carry around.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Plan for the SSH and Session Manager logging limitation

AWS states: “Logging isn’t available for Session Manager sessions that connect through port forwarding or SSH.” In these modes, SSH encrypts its payload inside the TLS connection and Session Manager acts as a tunnel, so Session Manager cannot record the commands or forwarded application data. The session still uses AWS-authorized access, but that does not make the SSH transcript available in Session Manager logs.

Account for that limitation in your audit design. If command-level records are required, consider whether the task can use a suitable alternative such as Run Command, or arrange appropriate logging at the operating-system or application layer. Validate that any chosen logging approach captures what your organization needs.

Best Value
BENFEI USB 3.0 to Ethernet Adapter, USB C to RJ45 Gigabit LAN (1000Mbps) Network Adapter, Compatible with MacBook/Pro/Air, Surface Pro, Windows 11/10/8/7, Mac OS [Aluminium Shell&Nylon Cable]
  • COMPACT DESIGN - The compact-designed portable BENFEI USB A/C to Ethernet adapter connects your computer or tablet to a router,modem or network switch for network connection. It adds a standard RJ45 port to your Ultrabook, notebook or Macbook Air for file transferring, video conferencing, gaming, and HD video streaming.
  • SUPERIOR STABILITY - Built-in advanced IC chip works as the bridge between RJ45 Ethernet cable and your USB A/C devices. The driver-free installation with native driver support in Chrome, Mac, and Windows OS; The USB A/C Ethernet adapter dongle supports important performance features including Wake-on-Lan (WoL), Full-Duplex (FDX) and Half-Duplex (HDX) Ethernet, Crossover Detection, Backpressure Routing, Auto-Correction (Auto MDIX).
  • INCREDIBLE PERFORMANCE - Supports full 10/100/1000Mbps gigabit ethernet performance over USB A/C's 5Gbps bus, faster and more reliable than most wireless connections. Link and Activity LEDs. USB powered, no external power required. Backward compatible with USB 2.0/1.1.✅ To reach 1Gbps, make sure to use CAT6 & up Ethernet cables.
  • BROAD COMPATIBILITY - The USB A/C-Ethernet adapter is compatible with Windows 11/10/8.1/8/7/Vista/XP, Mac OSX 10.6/10.7/10.8/10.9/10.10/10.11/10.12, Linux kernel 3.x/2.6, Android and Chrome OS.Compatible with IEEE 802.3, IEEE 802.3u and IEEE 802.3ab. Supports IEEE 802.3az (Energy Efficient Ethernet).❌Do Not Support Windows RT. (NOT compatible with Nintendo Switch.)
  • 18 MONTH WARRANTY - Exclusive BENFEI Unconditional 18-month Warranty ensures long-time satisfaction of your purchase; Friendly and easy-to-reach customer service to solve your problems timely.
Rank #4
Anker USB C to Ethernet Adapter, Portable 1 Gbps Network Hub
  • The Anker Advantage: Join the 65 million+ powered by our leading technology.
  • Instant Internet: Connect to the internet instantly from virtually any USB-C 3.0 device, and enjoy stable connection speeds of up to 1 Gbps.
  • Lightweight and Compact: The space-saving and portable design measures just over half an inch thick and weighs about the same as a AA battery.
  • Premium Build: Features a sleek aluminum exterior and braided-nylon cable to complement the design of high-end devices.
  • What You Get: PowerExpand USB-C to Gigabit Ethernet Adapter, welcome guide, 18-month worry-free warranty, and friendly customer service.

Troubleshoot common connection failures

  • The workflow cannot assume the role: Check the GitHub job’s OIDC permission, the role trust policy’s audience and subject conditions, and whether the repository and branch, tag, or environment match those conditions.
  • start-session cannot reach the target: Confirm the instance is an SSM managed node, the role can start the intended session, and the instance has connectivity to Systems Manager endpoints through its configured network path.
  • The proxy command fails on the runner: Verify that both AWS CLI and the Session Manager plugin are installed and available to the SSH process, and that the AWS CLI is using the credentials obtained through OIDC.
  • SSH reaches the tunnel but authentication fails: Check that SSH is running on the target port, the selected OS username is correct, and the workflow’s private key corresponds to a public key authorized for that user.
  • A forwarded service is unreachable: Confirm the service is listening on the destination port, the managed node can reach the remote host when forwarding to one, and the installed SSM Agent meets AWS’s minimum version for that forwarding mode.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.