/**
  * Gets the allocation id for given elastic ip
  * @param $ip
  *
  * @return mixed
  * @throws \Exception
  */
 private function getAllocationId($ip)
 {
     $addresses = $this->ec2Client->describeAddresses();
     foreach ($addresses['Addresses'] as $address) {
         if ($address['PublicIp'] == $ip) {
             return $address['AllocationId'];
         }
     }
     throw new \Exception("could not find allocation id for given ip address");
 }