Fix : Error handling on sqs send empty message batch
diff --git a/localstack/services/sqs/sqs_listener.py b/localstack/services/sqs/sqs_listener.py
index c49c21a25da59..c5cf72920dada 100644
--- a/localstack/services/sqs/sqs_listener.py
+++ b/localstack/services/sqs/sqs_listener.py
@@ -14,7 +14,7 @@
 from localstack.utils.analytics import event_publisher
 from localstack.services.awslambda import lambda_api
 from localstack.services.generic_proxy import ProxyListener
-from localstack.utils.aws.aws_responses import requests_response
+from localstack.utils.aws.aws_responses import requests_response, make_error
 
 XMLNS_SQS = 'http://queue.amazonaws.com/doc/2012-11-05/'
 
@@ -196,6 +196,13 @@ def get_external_port(headers, request_handler):
     return request_handler.proxy.port
 
 
+def validate_empty_message_batch(data, req_data):
+    data = to_str(data).split('Entries=')
+    if len(data) > 1 and not req_data.get('Entries'):
+        return True
+    return False
+
+
 class ProxyListenerSQS(ProxyListener):
     def forward_request(self, method, path, data, headers):
         if method == 'OPTIONS':
@@ -274,6 +281,11 @@ def return_response(self, method, path, data, headers, response, request_handler
                 queue_url = re.match(r'.*<QueueUrl>(.*)</QueueUrl>', content_str, re.DOTALL).group(1)
                 _set_queue_attributes(queue_url, req_data)
 
+        elif action == 'SendMessageBatch':
+            if validate_empty_message_batch(data, req_data):
+                msg = 'There should be at least one SendMessageBatchRequestEntry in the request.'
+                return make_error(code=404, code_string='EmptyBatchRequest', message=msg)
+
         # instruct listeners to fetch new SQS message
         if action in ('SendMessage', 'SendMessageBatch'):
             _process_sent_message(path, req_data, headers)
diff --git a/localstack/utils/aws/aws_responses.py b/localstack/utils/aws/aws_responses.py
index 62595bea1a2ca..8d26ea031cab1 100644
--- a/localstack/utils/aws/aws_responses.py
+++ b/localstack/utils/aws/aws_responses.py
@@ -6,6 +6,7 @@
 from localstack.constants import TEST_AWS_ACCOUNT_ID, MOTO_ACCOUNT_ID
 from localstack.utils.aws import aws_stack
 from requests.models import CaseInsensitiveDict
+from localstack.utils.common import short_uid
 
 
 def flask_error_response(msg, code=500, error_type='InternalFailure'):
@@ -47,6 +48,18 @@ def response_regex_replace(response, search, replace):
     response.headers['Content-Length'] = str(len(response._content))
 
 
+def make_error(message, code=400, code_string='InvalidParameter'):
+    response = Response()
+    response._content = """<ErrorResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"><Error>
+        <Type>Sender</Type>
+        <Code>{code_string}</Code>
+        <Message>{message}</Message>
+        </Error><RequestId>{req_id}</RequestId>
+        </ErrorResponse>""".format(message=message, code_string=code_string, req_id=short_uid())
+    response.status_code = code
+    return response
+
+
 class LambdaResponse(object):
     # this object has been created to support multi_value_headers in aws responses.
     def __init__(self):
diff --git a/tests/integration/test_sqs.py b/tests/integration/test_sqs.py
index 20f4ce39a76ed..d672b10869a7d 100644
--- a/tests/integration/test_sqs.py
+++ b/tests/integration/test_sqs.py
@@ -2,7 +2,7 @@
 import json
 import time
 import unittest
-
+from botocore.exceptions import ClientError
 from localstack.utils import testutil
 from localstack.utils.testutil import get_lambda_log_events, get_lambda_log_group_name
 from localstack.utils.aws import aws_stack
@@ -572,3 +572,30 @@ def test_get_queue_attributes(self):
         redrive_policy = json.loads(response['Attributes']['RedrivePolicy'])
         self.assertEqual(redrive_policy['maxReceiveCount'], 1)
         self.assertIn(redrive_policy['deadLetterTargetArn'], queue_arn1)
+
+    def test_send_message_batch_with_empty_list(self):
+        client = self.client
+        response = client.create_queue(QueueName='test-queue')
+        queue_url = response['QueueUrl']
+
+        try:
+            client.send_message_batch(QueueUrl=queue_url, Entries=[])
+        except ClientError as e:
+            self.assertEqual(e.response['Error']['Code'], 'EmptyBatchRequest')
+            self.assertEqual(e.response['ResponseMetadata']['HTTPStatusCode'], 404)
+
+        entries = [{
+            'Id': 'message{:02d}'.format(0),
+            'MessageBody': 'msgBody{:02d}'.format(0),
+            'MessageAttributes': {
+                'CustomAttribute': {
+                    'DataType': 'String',
+                    'StringValue': 'CustomAttributeValue{:02d}'.format(0)
+                }
+            }
+        }]
+
+        result = client.send_message_batch(QueueUrl=queue_url, Entries=entries)
+        self.assertEqual(result['ResponseMetadata']['HTTPStatusCode'], 200)
+        # clean up
+        client.delete_queue(QueueUrl=queue_url)

Fix : Error handling on sqs send empty message batch #1658 