0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS SDK for Ruby で VPC 内に Spot Request を送る

Last updated at Posted at 2013-10-18

東京リージョンの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)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?