Method: Tunl::Base#create_instance

Defined in:
lib/tunl.rb

#create_instance(name) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/tunl.rb', line 135

def create_instance(name)
	# launch instance with:
	#  os - ubuntu hardy 32 bit
	#  security_group: tunl_name
	#  key_pair: tunl_name
	log "launch", "instance ..."
	instances = ec2.launch_instances('ami-ed46a784',
		:key_name => "tunl_#{name}",
		:group_ids => ["tunl_#{name}"],
		:instance_type => 'm1.small',
		:availability_zone => 'us-east-1a',
		:user_data => %Q{#!/bin/sh
			echo "starting" > /tmp/user_data_status.txt
			echo "GatewayPorts clientspecified" >> /etc/ssh/sshd_config
			/etc/init.d/ssh restart
			echo "finished" > /tmp/user_data_status.txt
		})
	log "", "#{instances.first[:aws_instance_id]}"	
end