duhaime
duhaime

Reputation: 27594

AWS Lambda: unable to delete arn because it is a replicated function

I'm trying to delete an AWS Lambda function through the GUI, but am getting a response: There was an error deleting your function: Lambda was unable to delete arn:aws:lambda:us-east-1:624929674184:function:lambda-auth:1 because it is a replicated function.

enter image description here

How can one delete replicated Lambda functions?

Upvotes: 11

Views: 21173

Answers (4)

kolobok_ua
kolobok_ua

Reputation: 4200

If you tried every other answer, and it's still not deleting - wait 5-10 minutes and try again.

Upvotes: 3

Jerry Green
Jerry Green

Reputation: 1485

BHEERAJ's answer is good, but in my exact case I waited like 6 hours and nothing changed and the error was still ocurring, but then I also removed related S3 buckets (and to remove the bucket, I had to remove items inside it first):

https://s3.console.aws.amazon.com/s3

Then in about half a hour I tried to remove those Lambda functions, and finally it actually deleted.

Upvotes: -1

DHEERAJ
DHEERAJ

Reputation: 611

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 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 enter image description here
  7. It will open that @edgeLambda Version
  8. On the top menus - Actions -> Delete version enter image description here
  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 work :)

Please refer the link Delete Lambda@Edge Functions and Replicas, you will find it much useful.

Upvotes: 14

Brandon Miller
Brandon Miller

Reputation: 5065

Replicated functions are something Lambda@Edge uses, so I assume that's the case here even though it's not stated. You should review this document on how to delete these. You can't manually delete them at this time:

You can delete a Lambda@Edge function only when the replicas of the function have been deleted by CloudFront. Replicas of a Lambda function are automatically deleted in the following situations:

After you have removed the last association for the function from all of your CloudFront distributions. If more than one distribution uses a function, the replicas are removed only after the function is disassociated from the last one.

After you delete the last distribution that a function was associated with.

Replicas are typically deleted within a few hours.

Note:

Replicas cannot be manually deleted at this time. This helps prevent a situation where a replica is removed that you're still using, which would result in an error.

Upvotes: 6

Related Questions