|
| 1 | +(integrations-dynamo-cdc)= |
| 2 | +# DynamoDB CDC |
| 3 | + |
| 4 | +CrateDB Cloud enables continuous data ingestion from DynamoDB using Change Data |
| 5 | +Capture (CDC), providing real-time synchronization of your data. |
| 6 | + |
| 7 | +## Key Concepts |
| 8 | + |
| 9 | +The DynamoDB CDC integration in CrateDB Cloud allows you to keep your data |
| 10 | +synchronized between a DynamoDB table and your CrateDB Cloud cluster |
| 11 | +in real-time. |
| 12 | + |
| 13 | +### How It Works |
| 14 | + |
| 15 | +The integration functions in two main stages: |
| 16 | + |
| 17 | +1. **Initial Sync:** |
| 18 | + The integration performs a complete scan of your DynamoDB table. |
| 19 | + |
| 20 | +2. **Continuous Sync:** |
| 21 | + The integration uses a Kinesis Data Stream to read changes from your DynamoDB table. |
| 22 | + Please note the Kinesis Data Stream needs to be set up before you can use this stage. |
| 23 | + You can refer to the AWS documentation page |
| 24 | + [Getting started with Kinesis Data Streams for Amazon DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/kds_gettingstarted.html) |
| 25 | + to complete your setup. |
| 26 | + |
| 27 | +### Data Consistency and Mode |
| 28 | + |
| 29 | +For continuous sync, CrateDB Cloud uses a Kinesis Data Stream. This provides full items |
| 30 | +that are then written as either full inserts or full upserts to ensure data consistency. |
| 31 | +Directly reading CDC events from DynamoDB is limited to 1 day of history. By using |
| 32 | +a Kinesis Data Stream you can choose the retention policy that best suits your needs. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Create a new Integration |
| 37 | +A DynamoDB integration allows you to sync a single table from DynamoDB. You can reuse an existing Cloud secret across multiple integrations |
| 38 | +to continuously sync data from multiple DynamoDB tables. |
| 39 | + |
| 40 | +Supported authentication methods: |
| 41 | +- AWS Access Key and Access secret pair. |
| 42 | + |
| 43 | +### Optional setup for CDC |
| 44 | +This setup is only required if you want to enable the Continuous Sync. |
| 45 | +Please note that running a Kinesis data stream has additional costs that AWS will charge you directly. |
| 46 | + |
| 47 | +#### Set up a Kinesis Data Stream for CDC in AWS |
| 48 | +1. In the **AWS console**, go to **DynamoDB**. |
| 49 | +2. Go to **Tables**. |
| 50 | +3. Click on the table name you want to use. |
| 51 | +4. Click on the **Exports and streams** tab. |
| 52 | +5. On the **Amazon Kinesis data stream details** section, click the button **Turn On**. |
| 53 | +6. Click the **Create new** button right to **Destination Kinesis data stream**. |
| 54 | +7. Fill in the **Data stream name**. Please note you will need this name later when setting up the integration in CrateDB Cloud. |
| 55 | +8. Choose the capacity that best suits your needs. |
| 56 | +8. Choose a **Maximum record size** that can hold more than two times your biggest DynamoDB table items. |
| 57 | +9. Click the button **Create data stream**. |
| 58 | +10. The Kinesis data stream has now been created. If you want to change its retention policy (recommended), click on the tab **Configuration**, then click on **Edit** under the **Data retention** section. |
| 59 | +11. Select the data retention that suits you. At least 7 days is recommended. Please note the data retention period will have an impact on the cost of the Kinesis Data Stream. |
| 60 | +12. Back to the **Stream to an Amazon Kinesis data stream** DynamoDB page, select the newly created Kinesis Stream from the list. |
| 61 | +13. Click on **Turn on stream**. |
| 62 | + |
| 63 | + |
| 64 | +### Set Up Integration in CrateDB Cloud |
| 65 | + |
| 66 | +Follow these steps in the CrateDB Cloud Console to set up the DynamoDB CDC integration: |
| 67 | + |
| 68 | +:::::{stepper} |
| 69 | +#### Create an Integration |
| 70 | +1. Navigate to the **Import** section in the CrateDB Cloud Console. |
| 71 | +2. Click on the **DynamoDB** button. |
| 72 | + |
| 73 | +#### Configure Secret |
| 74 | +1. Choose **Add Secret** or select an existing one. |
| 75 | +2. Fill in the following details: |
| 76 | + :::{tab} AWS Secret |
| 77 | + - **Secret Name**: Provide a unique name for the secret. |
| 78 | + - **Access key**: The AWS access key ID that will be used. Please note this access key requires access to your DynamoDB table and, if CDC is enabled, also to the Kinesis data stream. |
| 79 | + - **Secret access key**: The AWS secret key. |
| 80 | + ::: |
| 81 | + |
| 82 | +#### Configure Integration Settings |
| 83 | +1. Enter a name for the integration. |
| 84 | +2. Select the integration mode: |
| 85 | + - **Full load only**: Imports the data once but doesn’t sync changes. |
| 86 | + - **Full load and CDC**: Imports the data and syncs changes in real-time. |
| 87 | + - **CDC only**: Syncs only new changes in real-time without importing existing data. |
| 88 | + |
| 89 | +#### Select source |
| 90 | +1. Enter the AWS region name the DynamoDB table is in. |
| 91 | +2. Enter the DynamoDB table name. |
| 92 | +3. If CDC is enabled, please also enter the Kinesis stream name. |
| 93 | + |
| 94 | +#### Select Target Table |
| 95 | +1. Specify the target table in your CrateDB Cloud cluster where the data will be synced. |
| 96 | +2. DynamoDB items will be inserted into an object column called `document`. |
| 97 | +3. Select the object type for the column: |
| 98 | + - **`dynamic`**: Allows indexing and columnar storage for faster querying. |
| 99 | + - **`ignored`**: Prevents type conflicts in CrateDB if your source data lacks a strict schema. |
| 100 | + |
| 101 | + :::{note} |
| 102 | + If your source data doesn't follow a strict schema, select `ignored` to avoid type conflicts. |
| 103 | + However, selecting `dynamic` provides faster query performance by utilizing indexes and columnar storage. |
| 104 | + ::: |
| 105 | + |
| 106 | + |
| 107 | +#### Create the Integration |
| 108 | +Click **Start import** to finalize the setup. CrateDB Cloud will now sync |
| 109 | +your DynamoDB data based on the selected settings. |
| 110 | +::::: |
| 111 | + |
| 112 | +### Column Name Restrictions |
| 113 | + |
| 114 | +Column or property names containing square brackets `[]` are not supported and |
| 115 | +are replaced with `_obkt_` and `_cbkt_` respectively. Likewise, column |
| 116 | +names containing dots `.` are not supported and are replaced with `_dot_`. |
| 117 | + |
| 118 | +:::{warning} |
| 119 | +This behavior may change in future releases. |
| 120 | +::: |
0 commit comments