Ruby 描述现货价格历史记录返回的无效可用区[eu-west-1a]
我使用的是AWS Ruby SDK,我使用的是由descripe\u spot\u price\u history返回的错误消息。错误消息显示:无效可用区:eu-west-1a 此消息仅针对欧洲的可用区域(eu-west-1a…)返回,而不针对美国东部的其他区域。你知道如何解决这个问题吗?谢谢大家! 以下是我的ruby脚本:Ruby 描述现货价格历史记录返回的无效可用区[eu-west-1a],ruby,amazon-ec2,amazon-web-services,Ruby,Amazon Ec2,Amazon Web Services,我使用的是AWS Ruby SDK,我使用的是由descripe\u spot\u price\u history返回的错误消息。错误消息显示:无效可用区:eu-west-1a 此消息仅针对欧洲的可用区域(eu-west-1a…)返回,而不针对美国东部的其他区域。你知道如何解决这个问题吗?谢谢大家! 以下是我的ruby脚本: begin ec2 = AWS::EC2.new( :access_key_id => access_key, :secret_access_ke
begin
ec2 = AWS::EC2.new(
:access_key_id => access_key,
:secret_access_key => access_secret)
response = ec2.client.describe_spot_price_history(
:start_time => start_time,
:end_time => end_time,
:instance_types => instance_type,
:product_descriptions => 'Linux/UNIX',
:availability_zone => availability_zone
)
prices = Array.new(response.spot_price_history_set.map(&:spot_price))
prices = prices.flatten.collect { |i| i.to_f }
puts prices
rescue
puts "Error: " + $!
exit 1
end
只需将ec2端点参数添加到ec2.new
ec2 = AWS::EC2.new(
:access_key_id => access_key,
:secret_access_key => access_secret,
:ec2_endpoint => 'ec2.eu-west-1.amazonaws.com')
我认为您需要将AWS::config中的
:ec2_endpoint
更改为,但我不确定是否将其作为答案发布。有关配置选项的更多详细信息—它可以工作!谢谢你,克里斯托弗:)