Normally S3 objects in localstack can be accessed via `http://localhost:4572/bucket/key`.

However, if the object is 7 MBs or larger, attempting to access it via this URL will result in a 403 error. Objects any smaller are retrieved as expected.

(Possibly related: Lambda response size is limited to 6MB. Perhaps that is being used by accident?)
import sys
import logging
import traceback
from moto.s3 import models as s3_models
from moto.server import main as moto_main
from localstack import config
from localstack.constants import DEFAULT_PORT_S3_BACKEND
from localstack.utils.aws import aws_stack
from localstack.utils.common import wait_for_port_open
from localstack.services.infra import (
    get_service_protocol, start_proxy_for_service, do_run)
from localstack.utils.bootstrap import setup_logging
LOGGER = logging.getLogger(__name__)
S3_MAX_FILE_SIZE_MB = 2048
def check_s3(expect_shutdown=False, print_error=False):
    out = None
    try:
        
        wait_for_port_open(DEFAULT_PORT_S3_BACKEND)
        
        out = aws_stack.connect_to_service(service_name='s3').list_buckets()
    except Exception as e:
        if print_error:
            LOGGER.error('S3 health check failed: %s %s' % (e, traceback.format_exc()))
    if expect_shutdown:
        assert out is None
    else:
        assert isinstance(out['Buckets'], list)
def start_s3(port=None, backend_port=None, asynchronous=None, update_listener=None):