Coder Social home page Coder Social logo

Comments (9)

abankspdx avatar abankspdx commented on August 11, 2024 9

I am having a similar issue.

Alex-Banks-MacBook-Pro:~ alex$ docker run -v "$PWD":/dynamodb_local_db -p 8000:8000 cnadiminti/dynamodb-local:latest
Initializing DynamoDB Local with the following configuration:
Port:	8000
InMemory:	false
DbPath:	/dynamodb_local_db
SharedDb:	true
shouldDelayTransientStatuses:	false
CorsParams:	*

This command works correctly:

aws dynamodb create-table --table-name myTable --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --endpoint-url http://0.0.0.0:8000

Alex-Banks-MacBook-Pro:~ alex$ aws dynamodb list-tables --endpoint-url http://0.0.0.0:8000 --output json
{
    "TableNames": [
        "myTable"
    ]
}

But from the Node tier,

{
    "message": "connect ECONNREFUSED 0.0.0.0:8000",
    "code": "NetworkingError",
    "errno": "ECONNREFUSED",
    "syscall": "connect",
    "address": "0.0.0.0",
    "port": 8000,
    "region": "us-east-1",
    "hostname": "0.0.0.0",
    "retryable": true,
    "time": "2018-01-26T19:56:36.794Z"
}

This is my db in the code:

const db = new AWS.DynamoDB({ apiVersion: '2012-08-10', endpoint: new AWS.Endpoint('http://0.0.0.0:8000') });

Any ideas?

from docker-dynamodb-local.

cnadiminti avatar cnadiminti commented on August 11, 2024

Hi @sanhardik

command: -inMemory : May I know why you are trying to create it in memory? Can you try without this?

from docker-dynamodb-local.

sanhardik avatar sanhardik commented on August 11, 2024

This docker container was to be setup only for testing and then destroyed and hence I added inMemory tag.

I did try it without it as well and had same issue.

from docker-dynamodb-local.

cnadiminti avatar cnadiminti commented on August 11, 2024

Okay. Got it.

Why is it localhost in DYNAMODB_URL='http://localhost:8000/? It should be dynamoDB. Isn't it?

from docker-dynamodb-local.

sanhardik avatar sanhardik commented on August 11, 2024

I did try that and its still giving "Connection Refused"

I am sure I am doing something wrong but not able to figure it out.

from docker-dynamodb-local.

cnadiminti avatar cnadiminti commented on August 11, 2024

I propose to verify the dynamodb instance as suggested in https://github.com/cnadiminti/docker-dynamodb-local#verify-the-dynamodb-local-instance-with-aws-cli. If this verification fails please provide more details about your docker version, image version, host info, etc.

from docker-dynamodb-local.

sanhardik avatar sanhardik commented on August 11, 2024

When I run the docker-compose command, I can see that it created the container for DynamoDB.

If I run the below command from my command line (which has my actual working AWS credentials), it works
aws dynamodb create-table --table-name myTable --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --endpoint-url http://0.0.0.0:8000

But if I run it through the Python code that I am using, it fails with Connection Refused Error.

My python code has the following:
dynamodb = boto3.resource('dynamodb', region_name='ap-southeast-2', aws_access_key_id='id', aws_secret_access_key='key', endpoint_url="http://localhost:8000")

Does it expect some particular ID and Key or anything should be ok ?

from docker-dynamodb-local.

sanhardik avatar sanhardik commented on August 11, 2024

I was able to figure out the issue.
DynamoDB takes sometime to start. By adding a delay, before performing any action on the dynamoDB solved the problem.

from docker-dynamodb-local.

cnadiminti avatar cnadiminti commented on August 11, 2024

Glad to hear that you are all set now!

from docker-dynamodb-local.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.