0

Question in the title, trying to figure out how to add a CreationPolicy to an ec2 instance in the cdk so that I can then send a cfn-signal command once the script finishes, to then mark the resource as create complete.

This is what I have so far, after creating the ec2 instance in the stack:

create_policy = CfnCreationPolicy(resource_signal=CfnResourceSignal(count=1, timeout="PT10M"))

I don't see a way in the docs to add that to the ec2 resource as a property. Just wondering what I should do next.

1 Answer 1

1

Add a Creation Policy by setting a CfnInstance construct's cfn_options attribute.

If your EC2 instance is built with the L2 Instance construct, first use escape hatch syntax to reference its underlying L1 CfnInstance construct:

my_cfn_instance = my_instance.node.default_child

my_cfn_instance.cfn_options.creation_policy = create_policy
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.