Created
January 15, 2017 16:35
-
-
Save blaffoy/6880852c7d0b417ea5ccae53977b868c to your computer and use it in GitHub Desktop.
Unlock password of AWS EC2 Windows instance, given private key. Will be prompted for key password if needed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws ec2 get-password-data --instance-id <instance-id> | grep PasswordData | sed 's/.*"PasswordData": "\(.*\)" /\1/' | sed 's/\\r//g' | sed 's/\\n//g' | base64 -d | openssl.exe rsautl -decrypt -inkey <private key path> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment