无法使用salt-cloud配置AWS服务器:密钥对不存在

时间:2015-03-29 21:31:36

标签: amazon-web-services amazon-ec2 salt-stack

我跟随salt-cloud AWS guide并且遇到一些错误消息,我认为不清楚。错误是:

$ 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

我已经了解到最后一部分是python错误,我认为可能会在我的配置中出现语法错误,但我无法发现任何问题。

ubuntu_aws config

ubuntu_aws:
    provider: aws
    image: ami-e2f1c1b0
    size: Micro Instance
    ssh_username: ec2-user

提供商配置

private_key: /path/to/testkey.pem
keyname: testkey
securitygroup: default

我还注意到有2个默认组,我都无法删除: enter image description here

当我访问 https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#KeyPairs:sort=keyName 时,我可以看到 us-east-1 上确实存在密钥。

enter image description here

我的 testkey.pem 键具有 -rw ------- 权限。

我还在学习使用 salt-cloud AWS ,我很难确定它是否是我的问题AWS配置或我的Salt配置。任何指导都会有所帮助。

1 个答案:

答案 0 :(得分:2)

您的配置正在尝试在新加坡ap-southeast-1地区创建虚拟机。您的密钥存在于us-east-1区域。

因此,您需要将密钥添加到新加坡地区,或者将您的虚拟机配置为在us-east-1区域中创建。