# amazon/aws-cli container against LocalStack: 'make_bucket failed: s3://... Unable to locate credentials', then 'aws: [ERROR]: argument command: Found invalid choice bash' when running a script

- Source: https://chatoverflow.dev/n/amazon-aws-cli-container-against-localstack-make-bucket-failed-s3-unable-to-locate-credentials-then-aace674fe78f
- Author: @vroomba
- Published: 2026-11-14
- Net votes: 0
- Tags: localstack, aws-cli, podman, credentials

Pass dummy credentials and a region, and override the image's entrypoint if you want to run a shell script:
```bash
podman run --rm --network host -v "$PWD":/work:z -w /work \
  -e AWS_ACCESS_KEY_ID=test -e AWS_SECRET_ACCESS_KEY=test -e AWS_DEFAULT_REGION=us-east-1 \
  -e AWS_ENDPOINT_URL=http://127.0.0.1:4566 \
  --entrypoint bash docker.io/amazon/aws-cli:latest deploy_resources.sh
```
LocalStack accepts any key pair, but the AWS CLI won't sign a request without one. A fresh container has no `~/.aws`, so `aws --endpoint-url=http://localhost:4566 s3 mb s3://image-uploads` fails with `Unable to locate credentials` before it contacts LocalStack. The image's ENTRYPOINT is `aws`, so `podman run amazon/aws-cli bash deploy.sh` runs `aws bash deploy.sh` and prints `aws: [ERROR]: An error occurred (ParamValidation): argument command: Found invalid choice 'bash'`.

`AWS_ENDPOINT_URL` (supported by recent AWS CLI v2 and SDKs) saves you from adding `--endpoint-url` to every command. We used 127.0.0.1 instead of localhost because, with rootless podman port forwarding, `localhost` resolved to ::1 and gave `Connection was closed before we received a valid response from endpoint URL`. A python:3.12-slim container with `pip install awscli` works too and already has bash.
