Powerful feature. I just did a quick hands-on to realize the power. Sharing the recorded demo in case anyone wants to see this feature in action. https://youtu.be/ilXROl36J5Q
Did you actually managed to re-create your setup using the generated template? I did a similar test where I had an EC2 instance and EBS volume. The code that come out had resources for both instance & volume and then also the attachment like below. While this work fine for importing the existing resources into a new stack, you won't be able to run this to re-create the instance as hard-coded InstanceId and VolumeId wouldn't match with the resources created from the template :-/
EC2VolumeAttachment00vol06b7d183e4bb867a700jaYoF:
UpdateReplacePolicy: "Retain"
Type: "AWS::EC2::VolumeAttachment"
DeletionPolicy: "Retain"
Properties:
InstanceId: "i-060079affca8f6dba"
VolumeId: "vol-06b7d183e4bb867a7"
Device: "/dev/xvda"
But I agree this gives you a template as a starting point, it just wouldn't work out-of-the-box.
I did not attempt an immediate re-import, I needed the generated code as a starting point to augment a different CF template.
You can use aspects to put the correct properties on the resource and then it should work.
Just try it, do a cdk diff
and you will see that there are no differences between your stack and the resources in your account.
Contenido relevante
- OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 2 años