Irina
Irina

Reputation: 1265

aws cdk: Unable to delete lambda edge

Couldn't delete lambda stack via aws cdk:

Lambda was unable to delete lambda because it is a replicated function.

enter image description here

Upvotes: 1

Views: 1394

Answers (2)

Eladio
Eladio

Reputation: 459

When deleting a CloudFormation Stack with CloudFront resource and associated Lambda@edge - CloudFormation first initiate a delete request for the CloudFront resource and the links to lambda@edge, since the lambda@edge is replicated to edges locations it takes up to a few hours to complete the links deletion.

My workaround is to run the complete clean-up in two phases -

  1. Delete the stack and ignore the DELETE_FAILED status if just the lambda was failed to be deleted (and the other resources were deleted successfully)

  2. Re-delete the DELETE_FAILED stack after a few hours (Or do it automatically using a cleanup lambda triggered by cron event to clean-up the CloudFormation stacks with DELETE_FAILED status)

Upvotes: 1

Peter Aron Zentai
Peter Aron Zentai

Reputation: 11740

If you are able to get in such a situation then yo most likely have freshly deleted a stack that did have lambda edge functions. In that case replicated functions get revealed (you dont see them while the edge function is inplace/being used). You dont need to do anything, just maybe to be patient - the replicated function will disappear after some time.

Upvotes: 0

Related Questions