Skip to content

Instantly share code, notes, and snippets.

@blaffoy
Created January 15, 2017 16:35
Show Gist options
  • Save blaffoy/6880852c7d0b417ea5ccae53977b868c to your computer and use it in GitHub Desktop.
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
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