0
0

【AWS】エラー「CloudFormation cannot update a stack when a custom-named resource requires replacing」の対処法

Posted at

概要

AWS Batchを記述したCloudformationテンプレートを更新したら、以下のエラーになりました。こちらの原因と対処法を解説します。

CloudFormation cannot update a stack when a custom-named resource requires replacing. Rename arn:aws:batch:ap-northeast-1:1234567890:compute-environment/xxxx-compute-environment and update the stack again.

原因

このエラーは、CloudFormationがカスタム名を持つリソースを置き換える必要がある場合に発生するもの。
今回で言うと、AWS Batchのcompute-environmentが該当します。

Batchのcompute-environmentの中身を少し変えたので、そうするとCloudFormationは新しいリソースを作成し、古いリソースを削除しようとしますが、カスタム名を持つリソースは直接置き換えることができない、という現象が起きていました。

対応

一時的にリソース名を変更すればスタックを更新できます。

Type: 'AWS::Batch::ComputeEnvironment'ComputeEnvironmentNameのところですね。
もし元の名前に戻したい場合は再度その名前にしてスタックを更新すればOKです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0