Cannot delete AWS Lambda@Edge replicas

Francois picture Francois · Jul 25, 2017 · Viewed 9.2k times · Source

This question already exists here but I think it will have more impact on SO.

I created an AWS Lambda@Edge function in order to rewrite Cloudfront URLs before they reach the Origin.
AWS Lambda@Edge Function are automatically replicated through all regions when published, so I was not surprised to see this in every region:

enter image description here

Here began the problems:
I deleted the Lambda@Edge because it was a test and I wanted to start a fresh new one, but the replicas weren't deleted at the same time.
It was no big deal at the time, I thought that I simply could create a new Lambda@Edge function.
But you can't because the Cloudfront trigger can only be used one function at a time (as the replicas use it, you cannot create a new one).
Moreover, the trigger cannot be deleted either.

So now I'm stuck with Lambda@Edge replicas everywhere that I cannot delete and I cannot create similar ones.


TL;DR

  • I created a Lambda@Edge with a CloudFront trigger
  • I deleted it to create a new (similar) one
  • Now there is a replica still existing
  • I can't delete the replica
  • I can't create a new Lambda@Edge because the trigger is already "in use" by the replica (that I can't delete)

I'd be grateful to get some help on this
François


EDIT:

I definitely think it's a bug because in my replica's page, the link to the Master ARN responds with a 404.

Answer

Francois picture Francois · Jul 25, 2017

I found part of an answer:

It turns out that I needed to delete the trigger in the behavior of Cloudfront.
Simply:

  • Go to your Cloudfront distribution's behaviors
  • Check the one triggering the LambdaEdge
  • Click Edit
  • Go at the very bottom of the page and click the X to delete the trigger

Still, I can't delete the replicas but at least I can create new lambdas for this trigger...