-1

I'm running localstack setup with docker-compose.yaml and below is the content of docker-compose.yaml

version: "3.8"
services:
   localstack:
     image: localstack/localstack:latest
     container_name: localstack_test
     ports:
       - "127.0.0.1:4566:4566"
       - "127.0.0.1:4463-4499:4463-4499"
     environment:
       - SERVICES=s3
       - DEBUG=1
       - DATA_DIR=/tmp/localstack/data
     volumes:
       - "./.localstack:/var/lib/localstack"
       - "/var/run/docker.sock:/var/run/docker.sock"

Whenever we try to hit the URL localhost:4566, it returns a blank page in browser and the docker logs are as below.

localstack    | 2023-02-08T13:06:25.695 DEBUG --- [  MainThread] plugin.manager             : plugin localstack.hooks.on_infra_ready:extensions_on_infra_ready is disabled
localstack    | 2023-02-08T13:06:25.695 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_ready.initialize_health_info = <function initialize_health_info at 0x7fbfdcf48310>)
localstack    | 2023-02-08T13:06:25.695 DEBUG --- [  MainThread] plugin.manager             : plugin localstack.hooks.on_infra_ready:initialize_health_info is disabled
localstack    | 2023-02-08T13:06:34.860 DEBUG --- [   asgi_gw_0] l.aws.handlers.service     : no service set in context, skipping request parsing
localstack    | 2023-02-08T13:06:34.864  INFO --- [   asgi_gw_0] localstack.request.http    : GET / => 200

Can anyone, please let me know what's the issue here ? it was invoking s3 initially without any changes and then restarting docker is causing this. Thanks in advance

  • it should display the buckets list in s3 and there are many online and youtube tutorials mentioning that.. –  Feb 10 '23 at 05:08
  • Have you created any buckets? It would help if you could share the all the steps you are taking to set up your AWS resources, and then explain what exactly the output is you expect. If you want to list s3 buckets, then you can use the aws cli: `aws --endpoint-url=http://localhost:4566 s3 ls` – thrau Feb 13 '23 at 17:03
  • @thrau, Thanks. aws cli works as exepected with the command and the issue is when localhost:4566 is hit in the browser it returns a blank page(white empty page ) whereas it should return the XML with tags atleast (when no buckets are available) https://stackoverflow.com/questions/68034637/unknown-host-when-using-localstack-with-spring-cloud-aws-2-3 This mentions to try with URL - http://s3.localhost.localstack.cloud:4566/ and it works.. This is not seen in the documentation. –  Feb 13 '23 at 17:45

1 Answers1

1

The behavior that a call to localhost:4566 would be interpreted as an S3 ListBuckets command was removed with LocalStack 1.0. You can get this behavior by calling instead http://s3.localhost.localstack.cloud:4566. Here's an example:

awslocal s3 mb s3://foo
curl s3.localhost.localstack.cloud:4566

will correctly output:

<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01"><Owner><ID>bcaf1ffd86f41161ca5fb16fd081034f</ID><DisplayName>webfile</DisplayName></Owner><Buckets><Bucket><Name>foo</Name><CreationDate>2023-02-26T23:34:47.000Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult>

and the localstack logs should output:

2023-02-27T00:34:53.745  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS s3.ListBuckets => 200
thrau
  • 2,915
  • 3
  • 25
  • 32