0

Couldn't delete lambda stack via aws cdk:

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

enter image description here

Irina
  • 939
  • 1
  • 8
  • 26

2 Answers2

1

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)

Eladio
  • 369
  • 1
  • 5
0

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.

Peter Aron Zentai
  • 11,482
  • 5
  • 41
  • 71