laravel-aws-eb icon indicating copy to clipboard operation
laravel-aws-eb copied to clipboard

Command start_cloudwatch_agent failed

Open rombat opened this issue 3 years ago • 2 comments
trafficstars

Hi I keep on having this error and I can't find how to fix it:

eb-engine.log

2022/08/05 07:31:35.220810 [INFO] Executing instruction: GetToggleForceRotate
2022/08/05 07:31:35.220814 [INFO] Checking if logs need forced rotation
2022/08/05 07:31:35.220832 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-west-1:373913685911:stack/awseb-e-8biyafh8zx-stack/2d2ddbc0-c631-11ec-82c6-0ab720d385df -r AWSEBAutoScalingGroup --region eu-west-1
2022/08/05 07:31:35.634737 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-west-1:373913685911:stack/awseb-e-8biyafh8zx-stack/2d2ddbc0-c631-11ec-82c6-0ab720d385df -r AWSEBBeanstalkMetadata --region eu-west-1
2022/08/05 07:31:35.926535 [INFO] Procfile not found. Generating default rsyslog config
2022/08/05 07:31:35.928038 [INFO] Running command /bin/sh -c systemctl restart rsyslog.service
2022/08/05 07:31:35.948521 [INFO] Executing instruction: PostBuildEbExtension
2022/08/05 07:31:35.948556 [INFO] Starting executing the config set Infra-EmbeddedPostBuild.
2022/08/05 07:31:35.948570 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:eu-west-1:373913685911:stack/awseb-e-8biyafh8zx-stack/2d2ddbc0-c631-11ec-82c6-0ab720d385df -r AWSEBAutoScalingGroup --region eu-west-1 --configsets Infra-EmbeddedPostBuild
2022/08/05 07:31:44.421555 [INFO] Error occurred during build: Command start_cloudwatch_agent failed

2022/08/05 07:31:44.422076 [ERROR] An error occurred during execution of command [app-deploy] - [PostBuildEbExtension]. Stop running the command. Error: Container commands build failed. Please refer to /var/log/cfn-init.log for more details. 

cfn-init.log

2022-08-05 07:31:44,395 [ERROR] Command start_cloudwatch_agent (/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/laravel_logs.json) failed
2022-08-05 07:31:44,395 [ERROR] Error encountered during build of postbuild_1_quadratus_stripe: Command start_cloudwatch_agent failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command start_cloudwatch_agent failed
2022-08-05 07:31:44,396 [ERROR] -----------------------BUILD FAILED!------------------------
2022-08-05 07:31:44,396 [ERROR] Unhandled exception during build: Command start_cloudwatch_agent failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 176, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 564, in build
    self.run_config(config, worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command start_cloudwatch_agent failed

If anyone has any idea, that would be appreciated. Thanks in advance

rombat avatar Aug 05 '22 07:08 rombat

Have same issue, its because the .ebextension 02_logs_cloudwatch_imds2.config isn't creating the file: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/laravel_logs.json or is creating it and getting deleted after deploy If I create the file manually it works

Frtrillo avatar Sep 26 '22 08:09 Frtrillo

Have same issue, its because the .ebextension 02_logs_cloudwatch_imds2.config isn't creating the file: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/laravel_logs.json or is creating it and getting deleted after deploy If I create the file manually it works

Fixed in PR #79

Frtrillo avatar Sep 26 '22 09:09 Frtrillo