Anyone has any Fabric recipe that shows how to connect to EC2 using the pem file?
I tried writing it with this manner: Python Fabric run command returns "binascii.Error: Incorrect padding"
But I'm faced with some encoding issue, when I execute the run()
function.
In the left navigation pane, under Network & Security, choose Key Pairs. Choose Create Key Pair and name your key pair your AWS Management Console username (e.g. student01). Choose Create. A PEM file is downloaded in your browser.
To use the pem file I generally add the pem to the ssh agent, then simply refer to the username and host:
ssh-add ~/.ssh/ec2key.pem fab -H ubuntu@ec2-host deploy
or specify the env information (without the key) like the example you linked to:
env.user = 'ubuntu' env.hosts = [ 'ec2-host' ]
and run as normal:
fab deploy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With