Utilizando a porta padrão exposta pelo Localstack.
#Configure Environment Variables
export LOCALSTACK_ENDPOINT_URL="http://localhost:4566"#Configure AWS CLI
aws configure --profile localstack
AWS Access Key ID [None]: test
AWS Secret Access Key [None]: test
Default region name [None]: us-east-1
Default output format [None]:Criação de um AWS CLI profile chamado localstack com os padrões utilizados para uso local.
Para verificar se a configuração ficou correta podemos executar o seguinte comando abaixo para listar os buckets
#Verify LocalStack configuration
aws --profile localstack --endpoint-url=$LOCALSTACK_ENDPOINT_URL s3 lspython3 -m venv .venv
source .venv/bin/activate
python3 -m pip install boto3
python3 -m pip install python-dotenvOs arquivos utilizam variáveis contidas no arquivo .env
python3 utils_dynamodb.py createtable- Retorna dados da tabela poc-python-dynamodb (CLI)
awslocal dynamodb describe-table --table-name poc-python-dynamodbReferencias:
https://hands-on.cloud/testing-python-aws-applications-using-localstack/