Fastec2 KeyError: "Resource not found: vpcs; {'isDefault': 'true'}"

I’m trying to work through this tutorial for the fastec2 tool:

I’m running this command:

fe2 launch --name base --ami ami-0c55b159cbfafe1f0 --disksize 50 --instancetype m5.xlarge --secgroupname <my security group name> --keyname <my keyname>

I’m getting this stack trace:

Traceback (most recent call last):
  File "/Users/gGandenberger/anaconda3/envs/fastai/bin/fe2", line 10, in <module>
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fastec2/", line 9, in main
    else: fire.Fire(EC2)
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fire/", line 127, in Fire
    component_trace = _Fire(component, args, context, name)
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fire/", line 366, in _Fire
    component, remaining_args)
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fire/", line 542, in _CallCallable
    result = fn(*varargs, **kwargs)
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fastec2/", line 347, in launch
    print(self.get_launch(name, ami, disksize, instancetype, keyname, secgroupname, iops, spot))
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fastec2/", line 335, in get_launch
    secgroupid = self.get_secgroup(secgroupname).id
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fastec2/", line 168, in get_secgroup
    vpc = self.resource('vpcs', isDefault='true')
  File "/Users/gGandenberger/anaconda3/envs/fastai/lib/python3.7/site-packages/fastec2/", line 114, in resource
    except StopIteration: raise KeyError(f'Resource not found: {coll_name}; {filters}') from None
KeyError: "Resource not found: vpcs; {'isDefault': 'true'}"

Hi Greg,

I have hit a few snags with VPCs as well. I was trying to use the VPCs that my company has, and we don’t have any of the VPCs marked is_default within AWS, thus I think this bit of code is failing to find which VPC to use. In my case, I think I will need to fork the fastec2 repo and rewrite the code a bit to allow for explicitely specifying the VPC. In your case, you might be able to…

  • log into the AWS console and create a new VPC and set it as default
  • create a new security group within a subnet of the new default VPC
  • specify --secgruopname for the newly created security group