- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hi there,
First of all, top choice to move to CDK!
This is a great question and something I have wished for myself in the past when trying to shift infrastructure into cdk code that was deployed manually in the console.
I am not sure where you found that information around a aws-cdk-stepfunctions-import package that you can use. I tried to Google it and found nothing.
As far as I am aware, this is not possible but there is a great way to use the Step functions ASL definition that you can pull out of the console.
It requires using this construct: https://constructs.dev/packages/@matthewbonig/state-machine/v/0.0.26?lang=python
You of course need to also think around getting your Lambdas set up too but there are many helpful blogs and tutorials on that.
It should hopefully not be an issue if you deploy new versions of the Lambdas and Step function, created from CDK. You can then delete the old ones. Just be careful around naming!
If you are interested in how to import existing resources into a cdk stack, this is a great article guiding you through that: (I am just guessing at some point you might want to move more things over)
https://medium.com/@visya/how-to-import-existing-aws-resources-into-cdk-stack-f1cea491e9
I know this is not the easiest solution but sadly for the moment this is the best we can do!
Hi, on top of what Emma has mentioned above, you can even just reference existing Lambda functions by leveraging CDK native methods starting with "from", as they typically indicate that they can import an pre-existent resource into CDK.
For Lambda an example is fromFunctionArn, available here: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html
Hope it helps ;)
Nice! This is very cool
Contenus pertinents
- demandé il y a 8 mois
- demandé il y a 2 mois
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 3 ans
Hi Emma,
Thanks for your response, will review the links you provided.
I'd just like to point out that the example provided in this documentation below does not work: https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-lambda-state-machine-cdk.html
It would also be great if there was a fully worked out example or tutorial for a python project for a multi-step step function in the cdk documentation.
Thanks!
I will take a look at this link around to see if there are any good tutorials! I will get back to you asap!