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개 답변
1
수락된 답변

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
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠