Permalink
Browse files

Launch EBS-optimized boxen on EC2

  • Loading branch information...
1 parent e2bdb4c commit 475765c148f69fc7e80095e7485b5a2a941879be Philip (flip) Kromer committed Feb 21, 2013
Showing with 16 additions and 10 deletions.
  1. +4 −3 lib/ironfan/dsl/ec2.rb
  2. +12 −7 lib/ironfan/provider/ec2/machine.rb
View
7 lib/ironfan/dsl/ec2.rb
@@ -15,6 +15,7 @@ class Ec2 < Cloud
magic :chef_client_script, String
magic :default_availability_zone, String, :default => ->{ availability_zones.first }
collection :elastic_load_balancers, Ironfan::Dsl::Ec2::ElasticLoadBalancer, :key_method => :name
+ magic :ebs_optimized, :boolean, :default => false
magic :flavor, String, :default => 't1.micro'
collection :iam_server_certificates, Ironfan::Dsl::Ec2::IamServerCertificate, :key_method => :name
magic :image_id, String
@@ -290,12 +291,12 @@ class IamServerCertificate < Ironfan::Dsl
'm1.medium' => { :price => 0.165, :bits => 64, :ram => 3840, :cores => 2, :core_size => 1, :inst_disks => 1, :inst_disk_size => 410, :ephemeral_volumes => 1 },
'c1.medium' => { :price => 0.17, :bits => 64, :ram => 1740, :cores => 2, :core_size => 2.5, :inst_disks => 1, :inst_disk_size => 350, :ephemeral_volumes => 1 },
#
- 'm1.large' => { :price => 0.32, :bits => 64, :ram => 7680, :cores => 2, :core_size => 2, :inst_disks => 2, :inst_disk_size => 850, :ephemeral_volumes => 2 },
+ 'm1.large' => { :price => 0.32, :bits => 64, :ram => 7680, :cores => 2, :core_size => 2, :inst_disks => 2, :inst_disk_size => 850, :ephemeral_volumes => 2, :ebs_optimizable => 500, },
'm2.xlarge' => { :price => 0.45, :bits => 64, :ram => 18124, :cores => 2, :core_size => 3.25, :inst_disks => 1, :inst_disk_size => 420, :ephemeral_volumes => 1 },
'c1.xlarge' => { :price => 0.64, :bits => 64, :ram => 7168, :cores => 8, :core_size => 2.5, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 4 },
- 'm1.xlarge' => { :price => 0.66, :bits => 64, :ram => 15360, :cores => 4, :core_size => 2, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 4 },
+ 'm1.xlarge' => { :price => 0.66, :bits => 64, :ram => 15360, :cores => 4, :core_size => 2, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 4, :ebs_optimizable => 1000, },
'm2.2xlarge' => { :price => 0.90, :bits => 64, :ram => 35020, :cores => 4, :core_size => 3.25, :inst_disks => 2, :inst_disk_size => 850, :ephemeral_volumes => 2 },
- 'm2.4xlarge' => { :price => 1.80, :bits => 64, :ram => 70041, :cores => 8, :core_size => 3.25, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 4 },
+ 'm2.4xlarge' => { :price => 1.80, :bits => 64, :ram => 70041, :cores => 8, :core_size => 3.25, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 4, :ebs_optimizable => 1000, },
'cc1.4xlarge' => { :price => 1.30, :bits => 64, :ram => 23552, :cores => 8, :core_size => 4.19, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 2, :placement_groupable => true, :virtualization => 'hvm' },
'cc1.8xlarge' => { :price => 2.40, :bits => 64, :ram => 61952, :cores =>16, :core_size => 5.50, :inst_disks => 8, :inst_disk_size => 3370, :ephemeral_volumes => 4, :placement_groupable => true, :virtualization => 'hvm' },
'cg1.4xlarge' => { :price => 2.10, :bits => 64, :ram => 22528, :cores => 8, :core_size => 4.19, :inst_disks => 4, :inst_disk_size => 1690, :ephemeral_volumes => 2, :placement_groupable => true, :virtualization => 'hvm' },
View
19 lib/ironfan/provider/ec2/machine.rb
@@ -8,7 +8,8 @@ class Machine < Ironfan::IaasProvider::Machine
:availability_zone=, :block_device_mapping, :block_device_mapping=,
:client_token, :client_token=, :collection, :collection=,
:connection, :connection=, :console_output, :created_at,
- :created_at=, :destroy, :dns_name, :dns_name=, :flavor, :flavor=,
+ :created_at=, :destroy, :dns_name, :dns_name=,
+ :ebs_optimized, :flavor, :flavor=,
:flavor_id, :flavor_id=, :groups, :groups=, :iam_instance_profile,
:iam_instance_profile=, :iam_instance_profile_arn=,
:iam_instance_profile_name=, :id, :id=, :identity, :identity=,
@@ -72,7 +73,7 @@ def to_display(style,values={})
# style == :minimal
values["State"] = state.to_sym
values["MachineID"] = id
- values["Public IP"] = public_ip_address
+ values["Public IP"] = public_ip_address
values["Private IP"] = private_ip_address
values["Created On"] = created_at.to_date
return values if style == :minimal
@@ -162,14 +163,14 @@ def self.create!(computer)
remember machine, :id => computer.name
# AWS sometimes takes too long to respond for this block's liking.
- # Expand its wait interval, so that it doesn't just bomb out
+ # Expand its wait interval, so that it doesn't just bomb out
# after three quick failures in succession.
# For more info, see:
# - http://rubydoc.info/gems/fog/1.9.0/Fog/Model#wait_for-instance_method
# - https://github.com/fog/fog/blob/master/lib/fog/core/wait_for.rb
fog_server.wait_for(Fog.timeout, 5) { ready? }
end
-
+
# tag the computer correctly
tags = {
'cluster' => computer.server.cluster_name,
@@ -230,8 +231,9 @@ def self.launch_description(computer)
:client_key => computer.private_key
}
- # Fog does not actually create tags when it creates a server;
- # they and permanence are applied during sync
+ # main machine info
+ # note that Fog does not actually create tags when it creates a
+ # server; they and permanence are applied during sync
description = {
:image_id => cloud.image_id,
:flavor_id => cloud.flavor,
@@ -241,7 +243,7 @@ def self.launch_description(computer)
:user_data => JSON.pretty_generate(user_data_hsh),
:block_device_mapping => block_device_mapping(computer),
:availability_zone => cloud.default_availability_zone,
- :monitoring => cloud.monitoring
+ :monitoring => cloud.monitoring,
}
# VPC security_groups can only be addressed by id (not name)
@@ -261,6 +263,9 @@ def self.launch_description(computer)
ui.warn "1.3.1 and earlier versions of Fog don't correctly support placement groups, so your nodes will land willy-nilly. We're working on a fix"
description[:placement] = { 'groupName' => cloud.placement_group.to_s }
end
+ if cloud.flavor_info[:ebs_optimizable]
+ description[:ebs_optimized] = cloud.ebs_optimized
+ end
description
end

0 comments on commit 475765c

Please sign in to comment.