简体   繁体   English

AWS使用“雾”创建实例

[英]AWS create instance using 'fog'

I am trying to create an AWS instance using rubygem fog . 我正在尝试使用rubygem fog创建一个AWS实例。 For some reason the bootstrap method just takes too long (more than 10 minutes) and my script times out. 由于某种原因,引导程序方法花费的时间太长(超过10分钟),并且我的脚本超时。 Here is what I am using 这是我正在使用的

server = @compute.servers.bootstrap(:key_name => 'mykey',
                                    :username => 'foo',
                                    :flavor_id => flavor_id,
                                    :image_id => image_id,
                                    :subnet_id => "my_subnet_id",
                                    :groups => ["my_security_group"])
server.wait_for { ready? }

When I tried to create the instance from AWS CLI and aws-ruby-sdk I was able to do that successfully with ease. 当我尝试从AWS CLI和aws-ruby-sdk创建实例时,我能够轻松地成功完成此操作。 Just the difference was instead of security group name I had to use security group id. 只是区别是我不得不使用安全组ID来代替安全组名称。 The fog gem cries if I dont specify :groups list and assigns default security group. 如果我不指定:groups列表并分配默认的安全组,则雾珠会哭。 I am trying to create my instance in a VPC. 我正在尝试在VPC中创建实例。 (FYI) (仅供参考)

在vpc内创建实例时,需要指定:security_group_ids选项(使用组ID而不是名称的数组)而不是:groups选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM