こんにちは!技術4課のイーゴリです。
CloudFront Distributionに紐付けたLambda@Edge関数を削除しようとすると、下記のようなエラーが発生します。対策方法は下記となります。

Lambda was unable to delete arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:add-header-function:2 because it is a replicated function. Please see our documentation for Deleting Lambda@Edge Functions and Replicas. が発生しました。
下記の記事に回答が記載してあるので、その通り削除します。
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 remove the last association for the function from all of your CloudFront distributions. If more than one distribution uses a function, the replicas are deleted only after you remove the function association from the last distribution.
- After you delete the last distribution that a function was associated with.
対象のCloudFront Distributionをクリックします。

[ビヘイビア]タブをクリックします。ビヘイビアを選択し、[編集]をクリックします。

[関数の関連付け]で[ビューワーリクエスト]の[関数タイプ]をクリックします。

[Lambda@Edge]から[関連付けなし]に変更します。

[変更を保存]をクリックします。

[サービス]>[Lambda]>[関数]>対象のLambda関数をクリックします。
[バージョン]タブをクリックし、バージョンを削除します。

[削除]をクリックします。

バージョンを削除できました。

もう一回Lambda関数を削除してみますと・・・

無事に削除できました!

以上、御一読ありがとうございました。
本田 イーゴリ (記事一覧)
カスタマーサクセス部
・2024 Japan AWS Top Engineers (Security)
・AWS SAP, DOP, SCS, DBS, SAA, DVA, CLF
・Azure AZ-900
・EC-Council CCSE
趣味:日本国内旅行(47都道府県制覇)・ドライブ・音楽