Skip to main content
  1. Commands/

ec2connect

bmc ec2connect connects to a running EC2 instance via SSH or AWS SSM Session Manager.

Usage #

bmc ec2connect               # Interactive instance picker
bmc ec2connect nginx         # Filter instances by name/ID/IP first
bmc ec2connect -i i-0abc123  # Connect to a specific instance ID
bmc ec2connect -u ubuntu     # SSH as a specific user (skips method picker)

Connection methods #

SSH #

Requires ssh on your PATH. BMC prompts for the SSH user (root, ubuntu, ec2-user, or custom) unless -u is specified.

SSM Session Manager #

Requires:

  • aws CLI v2
  • session-manager-plugin

Check with bmc doctor. No SSH keys or open ports needed.

Stopped instances #

If the selected instance is stopped, BMC behaviour depends on ec2.auto_start_stopped in config:

ValueBehaviour
prompt (default)Ask whether to start the instance
alwaysStart automatically without prompting
neverExit with an error

Prerequisites #

bmc doctor    # Check ssh, aws CLI, and session-manager-plugin