東京リージョンのVPC内に $0.005/h を上限とする t1.micro のスポットリクエストを送る
Ruby2.0.0-p247
aws-sdk 1.22.0
require "aws-sdk"
AWS.config(
:access_key_id => "access_key_id",
:secret_access_key => "secret_access_key",
:region => "ap-northeast-1"
)
ec2 = AWS::EC2.new
options = {
:instance_count => 1,
:spot_price => "0.005",
:launch_specification => {
:image_id => "ami-xxxxxxxx",
:key_name => "Key pair name",
:instance_type => "t1.micro",
:security_group_ids => ["sg-xxxxxxxx"],
:subnet_id => "subnet-xxxxxxxx",
},
}
ec2.client.request_spot_instances(options)