Help us understand the problem. What is going on with this article?

CloudFormationでRoute did not stabilize in expected timeが出る場合

More than 1 year has passed since last update.

CloudFormationで以下のようなエラーが出る場合があります。

Route did not stabilize in expected time

以下のtemplateでPNPrivateRoute(AWS::EC2::Route) を作成する際に発生しました。5分くらい処理が止まり、このエラーが出て終了してしまいます。

...

  PNNatGateway:
    Type: 'AWS::EC2::NatGateway'
    Properties:
      AllocationId: eipalloc-xxxxxx
      SubnetId: !Ref PNPublicSubnet
  PNPrivateRouteTable:
    Type: 'AWS::EC2::RouteTable'
    Properties:
      VpcId: !Ref PrivateNet
  PNPrivateRoute:
    Type: 'AWS::EC2::Route'
    Properties:
      RouteTableId: !Ref PNPrivateRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId: !Ref PNNatGateway

...

対応

GatewayIdで指定している箇所をNatGatewayIdに変更する。

...

  PNNatGateway:
    Type: 'AWS::EC2::NatGateway'
    Properties:
      AllocationId: eipalloc-xxxxxx
      SubnetId: !Ref PNPublicSubnet
  PNPrivateRouteTable:
    Type: 'AWS::EC2::RouteTable'
    Properties:
      VpcId: !Ref PrivateNet
  PNPrivateRoute:
    Type: 'AWS::EC2::Route'
    Properties:
      RouteTableId: !Ref PNPrivateRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId: !Ref PNNatGateway

...

原因

上記のとおり、GatewayIdはあくまでAWS::EC2::InternetGatewayのIDを指定するプロパティでありAWS::EC2::NatGatewayを指定したい場合はNatGatewayIdを利用しなければならないためです。

備考

あまりにも挙動とエラーメッセージがわかりにくい..。

sot528
ALISファウンダー CTO. ブロックチェーンとかやってます.
https://alis.to/users/AB2
alis
ブロックチェーンベースのSNS「ALIS」の開発・運用を行うスタートアップ
https://alis.to
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした