# DynamoDB to Cosmos DB NoSQL

[![Adiom on Azure Marketplace](https://assetsprod.microsoft.com/mpn/en-us/ms-azure-marketplace.png)](https://azuremarketplace.microsoft.com/en/marketplace/apps/adiom.adiom_dsync_vm_dynamo)

### Prerequisites

1. **Set up Temporal and SigNoz** (or another OTEL collector). You can follow the instructions in [Running Dsynct](/enterprise/running-dsynct.md)
2. **Obtain DynamoDB credentials** - you can create a new dedicated user in IAM with AmazonDynamoDBFullAccess permissions, and [create security keys for it](https://docs.aws.amazon.com/sdkref/latest/guide/access-iam-users.html).
3. **Obtain Cosmos DB credentials** - URI and Primary Key ("Settings" -> "Keys" in the left menu)
4. [**Enable Streams**](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html#Streams.Enabling) **in DynamoDB** - for the tables being migrated. Use "New image".

### Worker VM setup

<pre class="language-bash"><code class="lang-bash"><strong>## Set variables
</strong><strong>export SIGNOZ=http://&#x3C;SIGNOZ_HOST>:4317
</strong><strong>export TEMPORAL=&#x3C;TEMPORAL_HOST>:7233
</strong><strong>export AWS_ACCESS_KEY_ID=&#x3C;...>
</strong><strong>export AWS_SECRET_ACCESS_KEY=&#x3C;...>
</strong><strong>export AWS_REGION=&#x3C;...>
</strong><strong>export COSMOS_URI=&#x3C;...> #e.g. https://cosmos-nosql-west.documents.azure.com:443/
</strong><strong>export COSMOS_KEY=&#x3C;...>
</strong>
<strong>## Create internal network for Docker
</strong>docker network create mynet

## Cosmos DB NoSQL Connector
docker run -d \
--network mynet --name cosmosnosqlconnector \
-e OTEL_EXPORTER_OTLP_ENDPOINT=$SIGNOZ \
markadiom/cosmosnosqlconnector 8089 $COSMOS_URI $COSMOS_KEY

## Worker
docker run -d \
--network mynet --name dsyncworker \
-e OTEL_EXPORTER_OTLP_ENDPOINT=$SIGNOZ \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e AWS_REGION=$AWS_REGION \
markadiom/dsynct worker \
--namespace-mapping "dynamo_table:cosmos_db.container,dynamo_table1:cosmos_db.container1" \
--concurrent-activities 4 --sync-writer-workers 8 \
dynamodb \
grpc://cosmosnosqlconnector:8089 --insecure \
temporal --host-port $TEMPORAL \
app --otel
</code></pre>

{% hint style="info" %}
If data transformations are needed, you can use the embedded [YAML transformer](/enterprise/running-dsynct/data-transformations.md).
{% endhint %}

Use `docker logs -f cosmosnosqlconnector` or `docker logs -f dsyncworker` to follow container logs.

### Running the workflow

```bash
## Runner 
docker run \
--name dsyncrunner \
-p 8080:8080 \
-e OTEL_EXPORTER_OTLP_ENDPOINT=$SIGNOZ \
markadiom/dsynct run \
--namespace "dynamo_table" --namespace "dynamo_table1" \
temporal --host-port $TEMPORAL \
app --otel --host-port 0.0.0.0:8080
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adiom.io/enterprise/running-dsynct/dynamodb-to-cosmos-db-nosql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
