lib/simple_perf/cli/chaos.rb in simple_perf-0.0.8 vs lib/simple_perf/cli/chaos.rb in simple_perf-0.0.9
- old
+ new
@@ -39,12 +39,19 @@
:access_key_id => config['access_key'],
:secret_access_key => config['secret_key'])
ec2 = AWS::EC2.new(:region => config['region'])
ec2.instances.each do |i|
- if(i.ip_address == target)
- puts "Terminating instance: " + target
- i.terminate
+ if i.vpc_id
+ if(i.private_ip_address == target)
+ puts "Terminating instance with private IP: " + target
+ i.terminate
+ end
+ elsif
+ if(i.ip_address == target)
+ puts "Terminating instance with public IP: " + target
+ i.terminate
+ end
end
end
end
end
end
\ No newline at end of file