Can't delete Lambda@Edge even though previously associated CloudFront distribution was already destroyed

1.6k Views Asked by At

Even though CloudFront distribution which was assiciated with a number of Lambda functions deployed @edge was already destroyed a couple of days ago, I still can't delete my lambda: it keeps referencing me to the "documentation for Deleting Lambda@Edge Functions and Replicas." which says only one thing: you should wait for a couple of hours (not days)

Any suggestions what else could be preventing the lambda from being deleted?

P.S. I also double-checked that ALL versions of lambda do not have an association with any cloudfront distributions

2

There are 2 best solutions below

1
On

Somebody already gave a very good reply about this subject: https://stackoverflow.com/a/61454243/12451088

Although, long story short, if the CloudFront distribution is deleted, check that there are no IAM roles associated to this Lambda function. In my case, I needed to delete it as there was one role associated. Removing this role let me delete all the versions of the Lambda function.

1
On

We were in the same boat... couldn't delete the functions for days.

How we fixed it:

  1. Create a new distribution
  2. Associate the lambda with the new distribution
  3. Remove the association you just made
  4. Delete the lambda versions
  5. Delete the lambda

There might be some time in between these steps, but that finally got us unstuck!