Social Menu

AWS EC2 – RDP and PSRemoting with Private Keys

If you ever had to login to an EC2 instance in AWS which wasn’t AD joined, you probably know how to fetch the generated admin password. It is not hard, but requires some extra steps to actually open a working WinRM session or even copy-pasted passwords to login via RDP. Wouldn’t it be better to login to these instances by passing directly your EC2 Key-Pair?

CloudRemotingis my new PowerShell module that tries to solve these management tasks similarly as ssh -i <privatkey> does, but for rdp and for pssession.

You can simply install it with Install-Module CloudRemoting and it introduces two main alias: ec2rdp and ec2sn which are shorts to Enter-EC2RdpSession and Enter-EC2PSSession

Create PSSessions as an administrator – without a password

EC2 RDP Session with a PemFile

Administrator PSSessions to EC2 Instances – without a password

EC2 PSSession with a PemFile privatekey

Recently I also introduced another comfort function to set the default EC2 Key-pair, so you don’t even need to type the -PemFile parameters:Set-DefaultEC2PemFile -PemFile ~/.ssh/mykey.pem

So if you like this module, please spread the word and feel free fork and contribute to make it better.