where and how to read results of ebextensions execution?

后端 未结 5 1645
忘了有多久
忘了有多久 2020-12-17 08:53

I added .ebextensions/start.config file to the root folder of my WAR bundle (as suggested by AWS), deployed it to Elastic Beanstalk, but nothing happened. Where

5条回答
  •  囚心锁ツ
    2020-12-17 09:38

    You can tail some logs in the web UI to see whether your .ebextensions worked (via Elastic Beanstalk → view an environment → Logs). You should see a success or fail message for each command you define. (For example, for a command named 01_setup you'll see a message like command 01_setup succeeded.)

    Viewing command output

    Although the log snapshot will show that a command failed, it won't show the command output:

    [ERROR] Command 01_setup (setup.cmd) failed
    [ERROR] Error encountered during build of postbuild_0_server: Command 01_setup failed
    Traceback (most recent call last):
       
    

    You can connect to the underlying EC2 server and view the command output in the cfn-init-cmd.log file (that's c:\cfn\log\cfn-init-cmd.log in Windows, or /var/log/cfn-init-cmd.log in Linux). This provides more useful information:

    [INFO] Running command "setup.cmd"
    [INFO] -----------------------Command Output-----------------------
    [INFO]  'setup.cmd' is not recognized as an internal or external command,
    [INFO]  operable program or batch file.
    [INFO] ------------------------------------------------------------
    [ERROR] Exited with error code 1
    

    For help connecting to an EC2 instance, see Windows instructions.

    Further troubleshooting

    The command output also lets you run arbitrary commands to figure out what's going on. For example, which directory are the commands being executed in?

    Here's the .ebextensions file:

    container_commands:
      where_am_i:
        command: dir
    

    And here's the output in cfn-init-cmd.log:

    [INFO] Running command "dir"
    [INFO] -----------------------Command Output-----------------------
    [INFO]   Volume in drive C has no label.
    [INFO]   Volume Serial Number is 12A7-BAEB
    [INFO]  
    [INFO]   Directory of C:\inetpub\wwwroot
    [INFO]  
    [INFO]  05/29/2015  05:42 PM              .
    [INFO]  05/29/2015  05:42 PM              ..
    [INFO]  05/29/2015  05:42 PM              .ebextensions
    [INFO]  05/29/2015  05:31 PM              bin
    [INFO]  05/28/2015  05:20 PM               106 Global.asax
    [INFO]  05/28/2015  05:20 PM               498 packages.config
    [INFO]  05/28/2015  05:20 PM             2,054 README.md
    [INFO]  05/29/2015  06:56 PM             3,064 Web.config
    [INFO]                 4 File(s)          5,722 bytes
    [INFO]                 4 Dir(s)   4,553,273,344 bytes free
    [INFO] ------------------------------------------------------------
    [INFO] Completed successfully.
    

提交回复
热议问题