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?

已提问 7 个月前237 查看次数
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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则