LoginSignup
0
0

[EC2 Image Builder] エラーを乗り越え起動するまで

Posted at

この記事について

ImageBuilderを始めて使ってみたところ、エラーが出てBuildプロセスが完了しなかった。
ネットを検索するも、今回の原因にすぐたどり着けなったので同じ症状の方の助けになればとアップします。

出ていたエラー

CloudWatchLogsに以下のエラーがでていました。

2024-04-22T07:57:49.049Z
Instance status 'reachability' is passed (instance id: i-06b16484a909xxxxx)

2024-04-22T07:57:51.234Z
Action successful for step LaunchBuildInstance

2024-04-22T07:57:52.336Z
Sending command to instance to run

2024-04-22T07:57:52.849Z
Error while calling ssm:SendCommand: InvalidInstanceId

2024-04-22T07:57:55.058Z
Action failed for step LaunchBuildInstance. Retry attempt: 2

2024-04-22T07:57:55.589Z
Retry action after 90 second delay (attempt number 2)

#この後、ずっとRetryがタイムアウトまで続く...

結論

インフラストラクチャ設定に登録したサブネットで、「パブリックIPv4を自動割り当て」に"いいえ"が入っていたのがよくなかった。

この部分でした

2024-04-27_4_image_builder.png

公式ドキュメントを見てみよう

公式ドキュメント- EC2Image Builderのトラブルシュー
このページにも今回の原因が直に載ってなかったので、起動が難航したのでした。

パブリックIPが割り当てられないのでベースとなるEC2は準備できても、その後SSMと連携できなかったのだと思われます。

今回の原因がトリガーとなって起こりえる同種のトラブル

Cloud9を起動するときも、パブリックサブネットにEC2を立てると思います。その場合も、サブネットが外部にアクセスするため、IPV4の割り当てが必要ですし、サブネットにインターネットゲートウェイがあることが必要です。

ELBとAutoScalingを利用し高負荷時に追加でEC2が立ち上がる際にも、IPV4の自動割り当てが必要になるはずです。(未検証)

先行記事

【DeveloperIO】
reivent2019_report_01
reivent2019_report_02
reivent2019_report_03

補足情報

イメージ構築に使ったbuild用コンポーネントは下記のyamlです。
先行記事reivent2019_report_03で使われたいたものと同一です。

name: Apache Install
description: This is Apache Install testing document.
schemaVersion: 1.0

phases:
  - name: build
    steps:
      - name: InstallLinuxUpdate
        action: UpdateOS
      - name: InstallApache
        action: ExecuteBash
        inputs:
          commands:
            - sudo yum install httpd -y
            - sudo systemctl enable httpd
            - sudo systemctl start httpd
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