I'm following the salt-cloud AWS guide and am having a little trouble with an error message I believe to be unclear. The error is:
$ sudo salt-cloud -p ubuntu_aws test-vm
[INFO ] salt-cloud starting
[INFO ] Creating Cloud VM test-vm in ap-southeast-1
[ERROR ] EC2 Response Status Code and Error: [400 400 Client Error: Bad Request] {'Errors': {'Error': {'Message': "The key pair 'testkey' does not exist", 'Code': 'InvalidKeyPair.NotFound'}}, 'RequestID': '******************************'}
[ERROR ] There was a profile error: 'str' object does not support item assignment
I've learned that the last portion is a python error which I thought might suggest that there's a syntax error in my configuration, but I can't find any issues with it.
ubuntu_aws config
ubuntu_aws:
provider: aws
image: ami-e2f1c1b0
size: Micro Instance
ssh_username: ec2-user
provider config
private_key: /path/to/testkey.pem
keyname: testkey
securitygroup: default
I also noticed there are 2 default groups, neither of which I'm able to delete:
When I visit https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#KeyPairs:sort=keyName I can see that the key is indeed there on us-east-1.
My testkey.pem key has -rw------- permissions.
I'm still learning to use salt-cloud and AWS and I'm struggling to determine if it's an issue with my AWS config or something with my Salt config. Any guidance would be helpful.
Your configs are trying to create a vm in the ap-southeast-1
region, which is Singapore. Your key exists in the us-east-1
region.
So you either need to add your key to the singapore region, or configure your vm to be created in the us-east-1
region.