cannot launch instance
Closed this issue · 7 comments
when trying to launch an instance like in the tutorial with
$ fe2 launch base ami-08d658f84a6d84a80 50 m5.xlarge
I get this error:
Traceback (most recent call last):
File "/anaconda3/bin/fe2", line 10, in
sys.exit(main())
File "/anaconda3/lib/python3.6/site-packages/fastec2/init.py", line 482, in main
else: fire.Fire(EC2)
File "/anaconda3/lib/python3.6/site-packages/fire/core.py", line 127, in Fire
component_trace = _Fire(component, args, context, name)
File "/anaconda3/lib/python3.6/site-packages/fire/core.py", line 366, in _Fire
component, remaining_args)
File "/anaconda3/lib/python3.6/site-packages/fire/core.py", line 542, in _CallCallable
result = fn(*varargs, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/fastec2/init.py", line 307, in launch
print(self.get_launch(name, ami, disksize, instancetype, keyname, secgroupname, iops, spot))
File "/anaconda3/lib/python3.6/site-packages/fastec2/init.py", line 301, in get_launch
else : inst = self.request_demand(ami, keyname, disksize, instancetype, secgroupid, iops)
File "/anaconda3/lib/python3.6/site-packages/fastec2/init.py", line 281, in request_demand
spec = self._launch_spec(ami, keyname, disksize, instancetype, secgroupid, iops)
File "/anaconda3/lib/python3.6/site-packages/fastec2/init.py", line 261, in _launch_spec
assert self._describe('key_pairs', {'key-name':keyname}), 'default key not found'
AssertionError: default key not found
What could be the cause? The was credentials should be ok as $ was s3 ls
does not yield an error.
I am using anaconda, python 3.6.7 pretty much standard setup.
Regards
I ran into the same issue. Here are the details of my experience:
Create env to test fastec2:
$ conda create -y -n fastec2env python
Executing this on 2019-02-22T0939 installs the following:
ca-certificates pkgs/main/osx-64::ca-certificates-2019.1.23-0
certifi pkgs/main/osx-64::certifi-2018.11.29-py37_0
libcxx pkgs/main/osx-64::libcxx-4.0.1-hcfea43d_1
libcxxabi pkgs/main/osx-64::libcxxabi-4.0.1-hcfea43d_1
libedit pkgs/main/osx-64::libedit-3.1.20181209-hb402a30_0
libffi pkgs/main/osx-64::libffi-3.2.1-h475c297_4
ncurses pkgs/main/osx-64::ncurses-6.1-h0a44026_1
openssl pkgs/main/osx-64::openssl-1.1.1a-h1de35cc_0
pip pkgs/main/osx-64::pip-19.0.1-py37_0
python pkgs/main/osx-64::python-3.7.2-haf84260_0
readline pkgs/main/osx-64::readline-7.0-h1de35cc_5
setuptools pkgs/main/osx-64::setuptools-40.8.0-py37_0
sqlite pkgs/main/osx-64::sqlite-3.26.0-ha441bb4_0
tk pkgs/main/osx-64::tk-8.6.8-ha441bb4_0
wheel pkgs/main/osx-64::wheel-0.32.3-py37_0
xz pkgs/main/osx-64::xz-5.2.4-h1de35cc_4
zlib pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3
Then I activate the env:
$ conda activate fastec2env
Then I install fastec2 within the activated env:
$ python -m pip install git+https://github.com/fastai/fastec2.git
Trying to launch an instance produces an error:
$ fe2 launch base ami-005bdb005fb00e791 50 m5.xlarge
Traceback (most recent call last):
File "/Users/alexis/miniconda3/envs/fastec2env/bin/fe2", line 10, in <module>
sys.exit(main())
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 482, in main
else: fire.Fire(EC2)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fire/core.py", line 127, in Fire
component_trace = _Fire(component, args, context, name)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fire/core.py", line 366, in _Fire
component, remaining_args)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fire/core.py", line 542, in _CallCallable
result = fn(*varargs, **kwargs)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 307, in launch
print(self.get_launch(name, ami, disksize, instancetype, keyname, secgroupname, iops, spot))
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 301, in get_launch
else : inst = self.request_demand(ami, keyname, disksize, instancetype, secgroupid, iops)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 281, in request_demand
spec = self._launch_spec(ami, keyname, disksize, instancetype, secgroupid, iops)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 261, in _launch_spec
assert self._describe('key_pairs', {'key-name':keyname}), 'default key not found'
AssertionError: default key not found
Could this be an AWS configuration issue? This command works, which seems to confirm that that aws is correctly configured, since I can create an instance with that AMI manually:
$ aws ec2 run-instances --image-id ami-005bdb005fb00e791 --instance-type m5.xlarge --security-groups default
Sorry, my mistake. I did not have a defined key-pair with the name "default". When I fix that, and manually specify the key pair, the security group, then I get a different error when I try to launch an instance. I will experiment with this more. Sorry for sowing confusion.
FWIW, the error I get now is just a timeout:
fe2 launch --name base4 --ami ami-005bdb005fb00e791 --disksize 50 --instancetype m5.xlarge --keyname bespoke-alexis --secgroupname default
Traceback (most recent call last):
File "/Users/alexis/miniconda3/envs/fastec2env/bin/fe2", line 10, in <module>
sys.exit(main())
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 482, in main
else: fire.Fire(EC2)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fire/core.py", line 127, in Fire
component_trace = _Fire(component, args, context, name)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fire/core.py", line 366, in _Fire
component, remaining_args)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fire/core.py", line 542, in _CallCallable
result = fn(*varargs, **kwargs)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 307, in launch
print(self.get_launch(name, ami, disksize, instancetype, keyname, secgroupname, iops, spot))
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 303, in get_launch
return self._wait_ssh(inst)
File "/Users/alexis/miniconda3/envs/fastec2env/lib/python3.7/site-packages/fastec2/__init__.py", line 289, in _wait_ssh
s.connect((inst.public_ip_address, 22))
TimeoutError: [Errno 60] Operation timed out
really installing/creating a key pair called default was the "key" here, not AIM but in "network and security" -> key pairs
I am getting this error as well right now and having trouble following what your solution was. I have a key-pair in EC2 called 'default', in ~/.ssh/default.pem, but I cant seem to get it to recognize the key. I've tried the following commands but get that same error every time. Any one able to help out with this?
fe2 launch --name base4 --ami ami-005bdb005fb00e791 --disksize 50 --instancetype m5.xlarge --keyname default --secgroupname default
fe2 launch --name base4 --ami ami-005bdb005fb00e791 --disksize 50 --instancetype m5.xlarge --keyfile ~/.ssh/default.pem