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?

preguntada hace 7 meses237 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace 7 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas