Fisher Coder
Fisher Coder

Reputation: 3576

AWS CDK DataPipeline how to import an existing data pipeline

I have a datapipeline running already, previously manually created, now I'd like to use CDK code to manage it. How can I do so? (use aws cdk typescript library find/import this datapipeline and manage it)

Like for example, in AWS SNS, we could use fromTopicArn to import an existing topic.

But I've gone through the CDK lib for data pipelines, and didn't find something similar.

Thanks!

Upvotes: 0

Views: 283

Answers (1)

Matthew Bonig
Matthew Bonig

Reputation: 2136

When you use some of the static functions like fromTopicArn, you are only creating a reference to the existing resource, you aren't actually "importing" it so that your CDK code manages it.

To have your CDK (and therefore CFN) code start to manage resources, you need to use CFN 'import' routine to bring the resource in under control. You can reference the docs here:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html

I have written a guide that helps you understand how to work this process with your CDK code:

https://matthewbonig.com/2021/08/30/importing-with-the-cdk/

There is also a good write-up here too:

https://medium.com/@visya/how-to-import-existing-aws-resources-into-cdk-stack-f1cea491e9

These was written before the cdk import command was added to the CLI which now also helps this process along, although it's just a wrapper around the processes mentioned above.

Upvotes: 1

Related Questions