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개 답변
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
전문가
답변함 7달 전

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

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

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

관련 콘텐츠