Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Fabric For EC2

I am trying to create a fabfile.py so that I can deploy on EC2. I have the following in my fabfile.py:

from __future__ import with_statement
from fabric.api import *


def ec2():
    env.hosts = ['111.111.111.111'] 
    env.user = 'ubuntu'
    env.key_filename = '/path/to/my/pem/key.pem'

def run_ls():
    run('ls -alt')

'111.111.111.111' is the elastic ip of my instance, and i alway login with ubuntu, not root. when i run the following command

fab ec2 run_ls

i see the following output:

[111.111.111.111] Executing task 'run_ls'
[111.111.111.111] run: ls -alt

Fatal error: Host key for 111.111.111.111 did not match pre-existing key! Server's key was changed recently, or possible man-in-the-middle attack.

Aborting.

Not sure what is going on, but I can't find to seem any great tutorials on using fabric on ec2, and I do not know how that is possible.

Thanks

Update:

Looks like

env.hosts = ['111.111.111.111'] 

is not valid, you need to use the actually URL

env.hosts = ['mywebsite.com'] 

which fixed my issue

like image 389
josephmisiti Avatar asked Jun 11 '11 16:06

josephmisiti


People also ask

How do I change my EC2 instance configuration?

To edit an instance's configurationStop the instance, if it is not already stopped. On the Instances page, click an instance name to display the Details page. Click Edit to display the edit page. Edit the instance's configuration, as appropriate.

What is AWS fabric?

Elastic Fabric Adapter (EFA) is a network interface for Amazon EC2 instances that enables customers to run applications requiring high levels of inter-node communications at scale on AWS.

What is the difference between EFA and Ena?

Differences between EFAs and ENAs Elastic Network Adapters (ENAs) provide traditional IP networking features that are required to support VPC networking. EFAs provide all of the same traditional IP networking features as ENAs, and they also support OS-bypass capabilities.


1 Answers

You can also use the '--disable-known-hosts' switch to ignore this error.

like image 87
Alex Avatar answered Oct 23 '22 02:10

Alex