Turn off kinesis stream associated with dynamo table using aws sdk

0

I have a step function for doing a migration task on a dynamo table. I need to turn of the kinesis stream associated with the table using aws SDK first step and then run the migration task then turn the kinesis steam association with the table on. I could see resources for turning off the dynamostream but not kinesis stream associated with the table. Appreciate any help or resources on this. some sample code to turn off the dynamo stream is like below. Need help with turning off the kinesisstream associated with the table instead

// Import the required modules
const { DynamoDBClient, UpdateTableCommand } = require('@aws-sdk/client-dynamodb');

// Configure your AWS region
const region = 'us-west-2'; // Change to your AWS region

// Create a DynamoDBClient
const client = new DynamoDBClient({ region });

// Name of your DynamoDB table
const tableName = 'YourTableName';

// UpdateTable parameters to disable the stream
const updateParams = {
  TableName: tableName,
  StreamSpecification: {
    StreamEnabled: false
  }
};

// Define and send the UpdateTableCommand
const updateTable = new UpdateTableCommand(updateParams);

client.send(updateTable)
  .then(data => {
    console.log('DynamoDB stream disabled successfully:', data);
  })
  .catch(err => {
    console.error('Error disabling DynamoDB stream:', err);
  });

1 Answer
1
Accepted Answer

Hi,

Have you tried using DisableKinesisStreamingDestinationCommand instead of the UpdateTableCommand?

It sounds like it should fit your use case requirements:

Stops replication from the DynamoDB table to the Kinesis data stream. This is done without deleting either of the resources.

You can use EnableKinesisStreamingDestinationCommand to re-enable the Kinesis stream:

Starts table data replication to the specified Kinesis data stream at a timestamp chosen during the enable workflow. If this operation doesn't return results immediately, use DescribeKinesisStreamingDestination to check if streaming to the Kinesis data stream is ACTIVE.

Regards

AWS
answered 9 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions