Ec2 fixes to check endpoint connection before insert record to DB

In case of wrong password or endpoint vmdirac created many New records of instances.
Those fixes prevent of making the mess in DB.