Upon first running an aws cli command using localstack you might end up with the following error.

Unable to locate credentials. You can configure credentials by running "aws configure".

Easy way

The easy easiest way is to leverage a package called awscli-local.

pipx install awscli-local

Leveraging the awscli

If you want to use the cli pro

pipx install awscli

aws config --profile localstack
# put what you want for the keys, but enter a valid region like us-east-1

alias aws='aws --endpoint-url http://localhost:4566 --profile localstack'