amazon-web-servicesamazon-s3aws-clilocalstack

Localstack - bucket does not exists


Im trying to setup Localstack and AWS Cli I have installed sudo snap install aws-cli --classic to run command This is my compose:

services:
  localstack:
    image: localstack/localstack
    ports:
      - "4566:4566"
      - "4571:4571"
    environment:
      - AWS_ACCESS_KEY_ID=dummy
      - AWS_SECRET_ACCESS_KEY=dummy
      - AWS_DEFAULT_REGION=us-east-1
      - SERVICES=dynamodb,s3,sns,sqs,kms,lambda,cloudformation,cloudwatch

When i run command aws s3 mb s3://books --endpoint-url=http://localhost:4566 i see on console make_bucket failed: s3://books Unable to locate credentials As i understand this env variables available on docker container because previously i set this property from the command aws configure and it works. What i do wrong in my yaml file ? When i try to open health in browser i see this Error. What i missed ? enter image description here

I want to set credentials AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION in docker compose file (i don't know why this set up wrong) and i want to see health on browser


Solution

  • You need to set some of these configuration variables manually in your shell session, like:

    export AWS_ACCESS_KEY_ID="test"
    export AWS_SECRET_ACCESS_KEY="test"
    export AWS_DEFAULT_REGION="us-east-1"
    

    .. and then run the command:

    aws s3 mb s3://books --endpoint-url=http://localhost:4566
    

    The health endpoint that you are trying to access has been deprecated. The new endpoint is:

    curl -X GET localhost:4566/_localstack/health
    

    Hope this helps!