我正在使用以下命令启动一个新的 EC2 实例:
knife ec2 server create -I ami-f0b11187 --ssh-key "mykeyid" -f t2.micro --ssh-user ubuntu --identity-file ~/.ssh/mykey.pem -z --no-host-key-verify --server-connect-attribute public_ip_address
Instance ID: i-3675f897
Flavor: t2.micro
Image: ami-f0b11187
Region: eu-west-1
Availability Zone: eu-west-1b
Security Groups: default
Tags: Name: i-3675f897
SSH Key: mykeyid
Waiting for EC2 to create the instance......
Public DNS Name: ec2-52-19-107-179.eu-west-1.compute.amazonaws.com
Public IP Address: 52.19.107.179
Private DNS Name: ip-172-31-41-56.eu-west-1.compute.internal
Private IP Address: 172.31.41.56
Waiting for sshd access to become available..done
Doing old-style registration with the validation key at ...
Delete your validation key in order to use your user credentials instead
Connecting to 52.19.107.179
ERROR: TypeError: no implicit conversion of nil into String
知道为什么会出现最后一行吗?实例已创建,我现在可以通过 ssh 进入,但进程knife ec2
在此处中止,我必须单独执行引导操作。我真的很想将其归结为一个命令!
答案1
未配置的刀具可能是造成这种现象的原因。
我建议运行
knife configure
您还需要准备好一些证书文件,您可以通过以下方式轻松创建
openssl genrsa -des3 -out private.pem 2048