Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

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:


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.

This is the issue in pointers:

  • 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 definitely think it's a bug because, in my replica's page, the link to the Master ARN responds with a 404.

2 Answers

0 votes
by (44.4k points)

You have to delete the trigger in the behaviour of CloudFront.

Do this:

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

Still, I am not able to delete the replicas however a minimum of I can create new lambdas for this trigger...

0 votes
by (140 points)

Hi [yuvraj]( I have figured out the solution to delete Lambda@edge replica.

 1. Firstly, Login to CloudFront Console and go to your Distribution.

 2. Under the Behaviors Tab - tick the listed Behavior and edit

 3. Scroll down, Go to Lambda Function Associations and remove any Association by clicking the X.

 4. Press yes,edit to save the changes.

 --- Now that you have removed the Associations it's time to delete the Lambda@edge replicas

 5. Go to Lambda Console and open your lambda( you wish to delete).

 6. On the top menus - Qualifiers -> Versions-> choose the listed drop-down version

 7. It will open that @edgeLambda Version 

 8. On the top menus - Actions -> Delete version

 9. This way , deleting all the versions - you are left with $LATEST

 10. Deleting that also - you are finally able to delete the Lambda@edge Function

Note!>  Please remember to delete any IAM Roles and Permissions associated with Lambda@edge Functions.

I hope this will works for you, Enjoy :)

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories