From 4e85886da4985893b44e6f6983f13021f381738e Mon Sep 17 00:00:00 2001 From: Samuel Beaulieu Date: Fri, 22 Jul 2022 13:37:13 -0500 Subject: [PATCH] wait until instance reports being status ready (aws checks that it is reachable) which fixes a lot of the net:ssh issues for provisioning --- lib/vmpooler/providers/ec2.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/vmpooler/providers/ec2.rb b/lib/vmpooler/providers/ec2.rb index b7b0721..14a68f2 100644 --- a/lib/vmpooler/providers/ec2.rb +++ b/lib/vmpooler/providers/ec2.rb @@ -253,6 +253,15 @@ module Vmpooler batch_instance = connection.create_instances(config) instance_id = batch_instance.first.instance_id connection.client.wait_until(:instance_running, { instance_ids: [instance_id] }) + @logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance running") + ### System status checks + # This check verifies that your instance is reachable. Amazon EC2 tests that network packets can get to your instance. + # If this check fails, there might be an issue with the infrastructure that is hosting your instance (such as AWS power, networking, or software systems). You can restart or replace the instance, wait for Amazon EC2’s systems to resolve the issue, or seek technical support. + # This check does not validate that your operating system and applications are accepting traffic. + ### Instance status checks + # This check verifies that your instance's operating system is accepting traffic. + connection.client.wait_until(:instance_status_ok, { instance_ids: [instance_id] }) + @logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance ready to accept traffic") created_instance = get_vm(pool_name, new_vmname) # extra setup steps