Skip to content

stknohg/ec2rdp

Repository files navigation

ec2rdp

Remote Desktop Utility for Amazon EC2.

This tool assists you to easily connet to your EC2 instances with Remote Desktop Client.

Prerequisites

Required IAM actions

  • ec2:DescribeInstances
  • ec2:GetPasswordData
  • ec2:DescribeInstanceConnectEndpoints
  • ssm:DescribeInstanceInformation
  • ssm:StartSession
  • ssm:TerminateSession
  • ec2-instance-connect:OpenTunnel

Sample IAM policies are here.

How to install

Download ec2rdp binary and setup AWS CLI credential file.

Windows

You can use Scoop on Windows.

# Windows only
scoop bucket add stknohg https://github.com/stknohg/scoop-bucket
scoop install ec2rdp

macOS

You can use Homebrew Taps on macOS.

# macOS only
brew install stknohg/tap/ec2rdp

Commands

ec2rdp public

Connect to public EC2 instance with Remote Desktop Client.

ec2rdp public -i 'EC2 instance ID' -p 'Path to private key file (.pem)'

example

# Connect to EC2
PS C:\> $env:AWS_PROFILE='your_profile'
PS C:\> ec2rdp public -i i-01234567890abcdef -p C:\project\example.pem

ec2rdp ssm

Connect to EC2 instance with Remote Desktop Client via SSM port forwarding.

ec2rdp ssm -i 'EC2 instance ID' -p 'Path to private key file (.pem)'

example

# Connect to EC2
PS C:\> $env:AWS_PROFILE='your_profile'
PS C:\> ec2rdp ssm -i i-01234567890abcdef -p C:\project\example.pem

ec2rdp eice

Connect to EC2 instance with Remote Desktop Client via EC2 Instance Connect Endpoint.

ec2rdp eice -i 'EC2 instance ID' -p 'Path to private key file (.pem)'

You can also use --endpointid(-e) flag to specify EC2 Instance Connect Endpoint ID.

ec2rdp eice -e 'Endpoint ID' -i 'EC2 instance ID' -p 'Path to private key file (.pem)'

example

# Connect to EC2 via endpoint in the same VPC
PS C:\> $env:AWS_PROFILE='your_profile'
PS C:\> ec2rdp eice -i i-01234567890abcdef -p C:\project\example.pem

# Connect to EC2 via spcecified endpoint
PS C:\> ec2rdp eice -e eice-xxxxxxxxxx -i i-01234567890abcdef -p C:\project\example.pem

Customization

You can use --profile, --region parameters.

PS C:\> ec2rdp public -i i-01234567890abcdef -p C:\project\example.pem --profile your_profile --region ap-northeast-1

You can override RDP connection settings by --port, --user, --password parameters.

PS C:\> ec2rdp ssm -i i-01234567890abcdef --port 3390 --user MyAdmin --password

License

About

Remote Desktop Utility for Amazon EC2.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages