Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober 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 desk5 min

Manage Private EC2 Instances Without Opening Port 22 with AWS Systems Manager Session Manager

Session Manager lets you administer private EC2 instances while keeping inbound port 22 closed. Set up the agent, instance role, endpoint connectivity, operator permissions, and logging with these steps.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can administer a private Amazon EC2 instance with AWS Systems Manager Session Manager while keeping inbound port 22 closed. Session Manager uses the SSM Agent on the instance to initiate communication with AWS; the instance still needs outbound HTTPS connectivity to Systems Manager endpoints, either through internet egress or private VPC endpoints.

How Session Manager connects without inbound SSH

An operator starts a session from the AWS console or AWS CLI. The SSM Agent on the managed instance initiates the connection to Systems Manager, so the normal Session Manager shell workflow does not require an inbound firewall rule for SSH. AWS describes the model this way: “SSM Agent initiates all connections to the Systems Manager service in the cloud.” AWS Systems Manager VPC endpoint guidance.

As an Amazon Associate I earn from qualifying purchases.

Closing port 22 is not the same as disconnecting the instance from the network. The agent must be able to reach the required regional Systems Manager endpoints over HTTPS (port 443). That path can use outbound internet connectivity or private interface endpoints.

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

What the instance and operator need

A supported operating system and a running SSM Agent

The EC2 operating system must be supported by Session Manager, and SSM Agent must be installed and running. AWS lists agent version 3.0.222.0 or later for SSH sessions and port forwarding, and version 3.0.284.0 or later for streaming session data to CloudWatch Logs. These are feature-specific minimums; check the current Session Manager prerequisites before deployment, and keep the agent updated.

#1 Best Overall

An instance role for Systems Manager

Attach an IAM role to the EC2 instance so the agent can communicate with Systems Manager. AWS’s EC2 connection guidance identifies the AmazonSSMManagedInstanceCore policy as an example. If you configure S3 or CloudWatch Logs session logging, the role and destination policies also need the permissions required for that configuration. A custom policy should be checked against AWS’s current permissions guidance.

Operator permissions

The instance role and the operator’s IAM permissions serve different purposes. The role lets the node communicate with AWS; operator policies determine who can start sessions and which managed nodes they may access. Scope access to the intended instances and session types, and decide explicitly whether operators may start ordinary shell sessions, SSH tunnels, or port-forwarding sessions. See AWS’s Session Manager overview for the access model.

Choose a network path for a private instance

Network design What to configure Key consideration
Outbound internet connectivity Allow outbound HTTPS (port 443) from the instance to the required regional ssm, ssmmessages, and ec2messages endpoints. The instance needs outbound service connectivity, but Session Manager does not require inbound SSH. Consult the prerequisites and endpoint list.
PrivateLink interface VPC endpoints Create the Systems Manager interface endpoints needed in the VPC and permit HTTPS from the managed instance subnet in the endpoint security group. Instances can use this Systems Manager path without internet access, an internet gateway, or a NAT device. DNS, endpoint security groups, and endpoint policies must be configured correctly. See AWS VPC endpoint guidance and PrivateLink setup.

With custom DNS, configure the required forwarding to Amazon DNS. Add endpoints for any other services your configuration depends on: for example, an S3 or CloudWatch Logs endpoint when session preferences send logs to those destinations, or a KMS endpoint when the design uses KMS encryption. Missing optional-service connectivity can break logging or encryption-related behavior even when the core Systems Manager connection works. AWS documents these considerations in its VPC endpoint guidance and troubleshooting guide.

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

Configure access, logging, and encryption

Set operator boundaries before enabling sessions

Use IAM to grant session access only to the operators and managed nodes that need it. Review permissions for specific session documents and for SSH or port-forwarding features separately from general shell access. This makes the access boundary explicit rather than treating every session type as equivalent.

Choose the session data you need to retain

Session Manager can send supported session data to an S3 bucket or CloudWatch Logs log group, and it offers KMS encryption options. Configure destination policies and the necessary permissions; for instances without internet egress, make sure the relevant service endpoints are reachable. AWS’s session logging documentation describes supported logging options.

Session Manager cannot log session contents for SSH and port-forwarding sessions. SSH encrypts its data inside the TLS connection, and Session Manager tunnels that traffic rather than exposing the contents for logging. If an auditable transcript is required, account for this limitation when choosing between a Session Manager shell and a tunneled connection. See AWS’s logging guidance and SSH configuration documentation.

Implementation sequence

  1. Check the node: confirm the operating system is supported, SSM Agent is installed and running, and its version meets the needs of the features you plan to use.
  2. Attach the instance role: provide Systems Manager permissions, using AmazonSSMManagedInstanceCore as AWS’s documented example or a validated least-privilege custom policy. Add any permissions required for configured logging destinations.
  3. Provide endpoint connectivity: allow outbound HTTPS to the required regional endpoints, or create the corresponding interface VPC endpoints. Verify endpoint security-group ingress, DNS resolution, and endpoint policies.
  4. Scope operator IAM: authorize the intended operators to start sessions only on the appropriate managed nodes and to use only the session types they need.
  5. Configure observability: select S3 or CloudWatch Logs where appropriate, set permissions and any needed private endpoints, and decide whether the inability to log SSH and port-forwarding contents is acceptable.
  6. Start a test session: use the Systems Manager or EC2 console, or start a session with the AWS CLI. Confirm that the node is online as a managed node and that the chosen session and logging behavior match the design. AWS’s EC2 connection guide covers the connection options.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot a node that cannot start a session

  1. Check managed-node status: verify the instance is registered and online in Systems Manager, the instance role has the necessary permissions, and SSM Agent is running and current.
  2. Check the network path: verify outbound HTTPS to the required regional endpoints or, for PrivateLink, the endpoint configuration, security-group rules, endpoint policies, and DNS.
  3. Check logging dependencies: if session logging is enabled, confirm that the S3 bucket or CloudWatch Logs group exists and allows the configured writes. In a private subnet, verify connectivity to the destination service endpoint as well.
  4. Check feature requirements: if the session starts but a feature does not work, verify the agent minimum for that feature and the required local AWS CLI components for the operator’s workflow. AWS’s Session Manager troubleshooting guide covers common failures.

Choose between a shell and a tunnel

A standard Session Manager shell is the clearest fit when operators need an interactive command line and you want Session Manager to log supported session data. SSH over Session Manager and port forwarding can preserve workflows that depend on SSH or a forwarded port without opening inbound port 22 on the instance, but Session Manager cannot record the contents of those tunneled sessions. In either case, access is governed through IAM and the instance still needs its agent, role, and network path to AWS.

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

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.

Leave a Reply

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

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.