fastai / fastec2

AWS EC2 computer management for regular folks
121 stars 19 forks source link

fe2 script errors #13

Open Sumith1896 opened 5 years ago

Sumith1896 commented 5 years ago

Error log below

sumith@yoda:~/research/aws$ fe2 script myscript.sh inst1 <ip-address>
Traceback (most recent call last):
  File "/home/sumith/software/anaconda3/bin/fe2", line 10, in <module>
    sys.exit(main())
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fastec2/__init__.py", line 9, in main
    else: fire.Fire(EC2)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fire/core.py", line 127, in Fire
    component_trace = _Fire(component, args, context, name)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fire/core.py", line 366, in _Fire
    component, remaining_args)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fire/core.py", line 542, in _CallCallable
    result = fn(*varargs, **kwargs)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fastec2/ec2.py", line 457, in script
    ssh = self.ssh(inst, user, keyfile)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fastec2/ec2.py", line 405, in ssh
    key = paramiko.RSAKey.from_private_key_file(keyfile)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/paramiko/pkey.py", line 206, in from_private_key_file
    key = cls(filename=filename, password=password)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/paramiko/rsakey.py", line 55, in __init__
    self._from_private_key_file(filename, password)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/paramiko/rsakey.py", line 175, in _from_private_key_file
    data = self._read_private_key_file("RSA", filename, password)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/paramiko/pkey.py", line 279, in _read_private_key_file
    data = self._read_private_key(tag, f, password)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/paramiko/pkey.py", line 329, in _read_private_key
    raise PasswordRequiredException("Private key file is encrypted")
paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted

I did create SSH key-pairs before freezing the AMI but unable to run the script, any help appreciated!! @jph00

jph00 commented 5 years ago

Password protected key files aren't supported, sorry.

Sumith1896 commented 5 years ago

It seems like fe2 script was using my local ~/.ssh/id_rsa for some reason (fe2 launch and fe2 connect works fine!), I am now using fe2 script myscript.sh od1 --myip "XX.XX.XX.XX" --keyfile "~/.ssh/default.pem", I get the following error:

Traceback (most recent call last):
  File "/home/sumith/software/anaconda3/bin/fe2", line 10, in <module>
    sys.exit(main())
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fastec2/__init__.py", line 9, in main
    else: fire.Fire(EC2)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fire/core.py", line 127, in Fire
    component_trace = _Fire(component, args, context, name)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fire/core.py", line 366, in _Fire
    component, remaining_args)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fire/core.py", line 542, in _CallCallable
    result = fn(*varargs, **kwargs)
  File "/home/sumith/software/anaconda3/lib/python3.6/site-packages/fastec2/ec2.py", line 458, in script
    shutil.copy(scriptname, Path.home()/'fastec2'/name/scriptname)
  File "/home/sumith/software/anaconda3/lib/python3.6/shutil.py", line 241, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/sumith/software/anaconda3/lib/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/sumith/fastec2/od1/myscript.sh'