  def testGetInstanceById(self, mock_list_instances):
    """Test that an instance of an account can be found by its ID."""
    mock_list_instances.return_value = aws_mocks.MOCK_LIST_INSTANCES
    found_instance = aws_mocks.FAKE_AWS_ACCOUNT.ec2.GetInstanceById(
        aws_mocks.FAKE_INSTANCE.instance_id)
    self.assertIsInstance(found_instance, ec2.AWSInstance)
    self.assertEqual('fake-instance-id', found_instance.instance_id)
    self.assertEqual('fake-zone-2', found_instance.region)
    self.assertEqual('fake-zone-2b', found_instance.availability_zone)
    with self.assertRaises(errors.ResourceNotFoundError):
      aws_mocks.FAKE_AWS_ACCOUNT.ec2.GetInstanceById('non-existent-instance-id')
Test that an instance of an account can be found by its ID.
tests/providers/aws/internal/test_ec2.py