0

根据此链接,可以标记现场车队实例。标签会自动传播到启动的实例。是否可以对普通的现场实例做同样的事情?到目前为止我的方法

ec2 = Aws::EC2::Resource.new({region: region, credentials: creds})
launch_specification ={
  :security_groups => ['ccc'],
  :ebs_optimized => true,
  :image_id => "image_id",
  :instance_type => "type",
  :key_name => "key",
  :placement => {:group_name => "ggg"},
  :user_data => ""        
} 
resp = ec2.client.request_spot_instances(:instance_count => count,
  :launch_specification => launch_specification,
  :spot_price => price.to_s,
  :type => 'one-time',
  :dry_run => false
)
resp.spot_instance_requests.each do |sir|
  ec2.create_tags({
    dry_run: false,
    resources: [sir.spot_instance_request_id],
    tags: [
          {
            key: "owner",
            value: "ooo",
          },
        ],
      })
end

为 的创建标签spot_instance_request,但不会传播到已启动的实例。

4

0 回答 0