Importing the Existing Resources into CloudFormation management, It doesn't seem to explain an option of importing through CDK

0

Importing the existing resources into CloudFormation management: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html, It doesn't seem to explain an option to import through **CDK ** . how can we achieve that through CDK? In my case here, I created a new pipeline app, stack through CDK for an account thats holding manually created DDB Tables. I would want to import existing DDB tables that were created manually on console,I want to enable streams on these tables from CDK. could you please guide me here?

1 réponse
1

For that you use either fromTableName, fromTableArn methods from the DynamoDB Table construct:

import * as cdk from '@aws-cdk/core';
import * as dynamodb from '@aws-cdk/aws-dynamodb';

class MyStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const existingTable = dynamodb.Table.fromTableName(this, 'ExistingTable', 'YourExistingTableName');
  }
}
profile pictureAWS
EXPERT
répondu il y a 7 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions

Contenus pertinents