简体   繁体   中英

Auto deployment on amazon server using fabric

I am trying to write a fab file which will do the auto deployment of my code on amazon server. So for that I am giving the SSH connection path at the top of the fabric method. But its not connecting and asking for password. I have the .pem file using which I am able to connect successfully from my Ubuntu terminal. But the same thing is not working when I am trying to do through fabric and its asking for password.

Example Code snippet of my fabric file.

from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm

@hosts('-i /path/to/file/project.pem ubuntu@ec2-11-111-1111-11.mm-east-1.compute.amazonaws.com')
def host_type():

    """
    Method used to see the machines OS.
    """

    run('uname -s')

Is there any way to make it password less. Thanks

Set up your public and private keys SSH authentication (the id_rsa and id_rsa.pub files). Check here if you have any problem.

Then, put the id_rsa.pub content into ~/.ssh/authorized_keys of your remote server.

Lastly, configure Fabric to use the key env.key_filename = "~/.ssh/id_rsa"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM