Possible CLI Bug: Dynamo DB endpoint URL does not work locally with active and correct credentials set

0

Summary:

Dynamo DB commands from the CLI do not work when real credentials are set up. The 'endpoint-url' flag should work around this and recognize that localhost endpoints can be hit with no credentials given the default setup of the AWS Dynamo Docker image.

Output of command after setting credentials: An error occurred (ResourceNotFoundException) when calling the DescribeTable operation: Cannot do operations on a non-existent table

Is there a fix or workaround for this?

System:

MacOS Monterey version 12.0.1, Macbook Pro - M1 - 2020

'aws --version' ->
aws-cli/2.4.11 Python/3.9.10 Darwin/21.1.0 source/arm64 prompt/off

To reproduce:

-- Start from a terminal that does NOT have AWS Credentials set up via environment variables or anything else

-- Start up a local Dynamo DB Instance on Docker:

  docker pull amazon/dynamodb-local
  docker run -p 8000:8000 --name=ddblocal -d amazon/dynamodb-local

-- Create a table:

aws dynamodb create-table    --attribute-definitions "[{ \"AttributeName\": \"key\", \"AttributeType\": \"S\"}, { \"AttributeName\": \"valueA\", \"AttributeType\": \"S\"}]"     --table-name test_table     --key-schema "[{\"AttributeName\": \"key\", \"KeyType\": \"HASH\"}, {\"AttributeName\": \"valueA\", \"KeyType\": \"RANGE\"}]"     --endpoint-url "http://localhost:8000"    --provisioned-throughput "{\"ReadCapacityUnits\": 100, \"WriteCapacityUnits\": 100}"    --region local

-- Query the table (to prove it works):

aws dynamodb describe-table --table-name test_table --region local --endpoint-url "http://localhost:8000"

-- Set your real AWS Credentials:

export AWS_ACCESS_KEY_ID="<REAL KEY ID HERE>"
export AWS_SECRET_ACCESS_KEY="<REAL SECRET KEY HERE>"
export AWS_SESSION_TOKEN="REAL TOKEN HERE>"

-- Query the table again (This one fails for me - see output above)

aws dynamodb describe-table --table-name test_table --region local --endpoint-url "http://localhost:8000"
Jaera
已提問 2 年前檢視次數 672 次
1 個回答
0

This is a known Issue DynamoDBLocal doesn't work properly with M1(ARM) processors. We don't have plans to directly support it right now, but our Docker containers do work.

If you have docker download then you can run the following code:

docker pull amazon/dynamodb-local:latest
docker run -p 8000:8000 amazon/dynamodb-local:latest

This will pull the latest version, run the docker container, and bind it to port 8000 which would be the same thing if you were to run it locally.

AWS
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南