diff --git a/nixops/backends/ec2.py b/nixops/backends/ec2.py index a6760c9b3..dff4d7ee8 100644 --- a/nixops/backends/ec2.py +++ b/nixops/backends/ec2.py @@ -266,13 +266,15 @@ def _get_spot_instance_request_by_id(self, request_id, allow_missing=False): """Get spot instance request object by id.""" self.connect() result = self._conn.get_all_spot_instance_requests([request_id]) + + request_id_filter = {'Name': 'spot-instance-request-id', 'Values': [request_id]} + result = [req for req in self._conn.describe_spot_instance_requests(Filters=[request_id_filter])] if len(result) == 0: if allow_missing: return None raise EC2InstanceDisappeared("Spot instance request ‘{0}’ disappeared!".format(request_id)) return result[0] - def _get_instance(self, instance_id=None, allow_missing=False, update=False): """Get instance object for this machine, with caching""" if not instance_id: instance_id = self.vm_id diff --git a/nixops/ec2_utils.py b/nixops/ec2_utils.py index fc1b05a2e..f4ecd7169 100644 --- a/nixops/ec2_utils.py +++ b/nixops/ec2_utils.py @@ -115,7 +115,8 @@ def handle_exception(e): def get_volume_by_id(conn, volume_id, allow_missing=False): """Get volume object by volume id.""" try: - volumes = conn.get_all_volumes([volume_id]) + volumes = [vol for vol in conn.volumes.filter(Filters=[{'Name': 'volume-id', + 'Values': [volume_id]}])] if len(volumes) != 1: raise Exception("unable to find volume ‘{0}’".format(volume_id)) return volumes[0]