# Cannot connect to serverless-dynamodb-local

**URL:** <https://forum.serverless.com/t/cannot-connect-to-serverless-dynamodb-local/12800>\
**Category:** Serverless Framework\
**Created:** [October 8, 2020, 4:57am UTC](https://forum.serverless.com/t/cannot-connect-to-serverless-dynamodb-local/12800 "2020-10-08T04:57:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdc18](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jdc18/32/4608_2.png) [@jdc18](https://forum.serverless.com/u/jdc18)\
**Post date:** [October 8, 2020, 4:57am UTC](https://forum.serverless.com/t/cannot-connect-to-serverless-dynamodb-local/12800/1 "2020-10-08T04:57:34Z")

</div>

Hi I installed serverless-dynamodb-local, but I cannot connect to the my local dynamodb instance.  
When I start sls I get  
sls offline start --noTimeout --httpPort 4000 --sharedDb  
Dynamodb Local Started, Visit:xxx://localhost:8000/shell  
Serverless: DynamoDB - created table Fact  
offline: Starting Offline: dev/us-east-1.  
offline: Offline [http for lambda] listening on xxx://localhost:3002  
offline: Function names exposed for local invocation by aws-sdk:  
I can access [http://localhost:8000/shell](http://localhost:8000/shell) and i see that it is running.  
I can do telnet to localhost 8000.

```
I tried to connect with
dynamodb = boto3.resource('dynamodb',
            region_name='localhost',
            aws_access_key_id="test_id",
            aws_secret_access_key="my_secret", 
            endpoint_url="http://localhost:8000")

```

I do not use access or secret i get that credentials cannot be found.  
So i added those and I get  
[ERROR] EndpointConnectionError: Could not connect to the endpoint URL: “xxx://localhost:8000/”

I added serverless-python-requirements recetnly but it didnt help either. This is my serverless.yml file:

```
service: pala-backend

frameworkVersion: '2'

plugins:
  - serverless-offline
  - serverless-dynamodb-local
  - serverless-python-requirements

provider:
  name: aws
  runtime: python3.8

functions:
  checkImage:
    handler: handler.check_image
    events:
      - http:
          path: check
          method: post
  

custom:
  serverless-offline:
    noPrependStageInUrl: true
    useDocker: true
  dynamodb:
    stages:
      - dev
    start:
      port: 8000
      inMemory: true
      migrate: true
  pythonRequirements:
    dockerizePip: non-linux
```

---

<div class="post-metadata">

**Author:** ![btalberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/btalberg/32/4694_2.png) [@btalberg](https://forum.serverless.com/u/btalberg)\
**Post date:** [November 10, 2020, 11:19pm UTC](https://forum.serverless.com/t/cannot-connect-to-serverless-dynamodb-local/12800/2 "2020-11-10T23:19:56Z")

</div>

I’m having the same exact problem @jdc18. Did you ever find a solution?

---

<div class="post-metadata">

**Author:** ![btalberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/btalberg/32/4694_2.png) [@btalberg](https://forum.serverless.com/u/btalberg)\
**Post date:** [November 11, 2020, 12:23am UTC](https://forum.serverless.com/t/cannot-connect-to-serverless-dynamodb-local/12800/3 "2020-11-11T00:23:54Z")

</div>

@jdc18 - I found a solution for my use case. I am running **serverless-offline** with the setting `useDocker: True`. Because my handler(s) run in Docker, I needed to [use the special DNS name](https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds) that allows the container access to my local network.

```
client = boto3.resource(
    'dynamodb',
    region_name='localhost',
    endpoint_url='http://host.docker.internal:8000'
)
```
