am using Elastic Beanstalk without container, just the EC2 instance. Sometimes it fails without any reason when it create a new instance. I found some weird logs or almost nothing:
May 20 20:32:48 ip-172-31-14-242 audit[10978]: AVC avc: denied { open } for pid=10978 comm="nginx" path="/var/log/nginx/error.log" dev="nvme0n1p1" ino=3682049 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:cloud_log_t:s0 tclass=file permissive=1
[2024-05-20T20:21:47.035Z] Sending signal 0 to CFN wait condition https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-1%3A576017513047%3Astack/awseb-e-xcvkczyzt5-stack/3804c910-892f-11ee-abd9-0a6f02a2186d/AWSEBInstanceLaunchWaitHandle?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20231122T120405Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86399&X-Amz-Credential="""""%""""%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=abf31ed864bec2be68aa61889b6b2a836c610de7ba3bed93dce80c1ee7589faa
Error signaling CloudFormation: [Errno 403] HTTP Error 403 : <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Request has expired</Message><X-Amz-Expires>86399</X-Amz-Expires><Expires>2023-11-23T12:04:04Z</Expires><ServerTime>2024-05-20T20:21:47Z</ServerTime><RequestId>Edited</RequestId><HostId>Edited=</HostId></Error>
2024-05-20 19:44:47,211 [ERROR] -----------------------BUILD FAILED!------------------------
2024-05-20 19:44:47,212 [ERROR] Unhandled exception during build: [Errno 2] No such file or directory: '/var/app/staging/'
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 181, in <module>
worklog.build(metadata, configSets, strict_mode)
File "/usr/lib/python3.9/site-packages/cfnbootstrap/construction.py", line 137, in build
Contractor(metadata, strict_mode).build(configSets, self)
File "/usr/lib/python3.9/site-packages/cfnbootstrap/construction.py", line 567, in build
self.run_config(config, worklog)
File "/usr/lib/python3.9/site-packages/cfnbootstrap/construction.py", line 579, in run_config
CloudFormationCarpenter(config, self._auth_config, self.strict_mode).build(worklog)
File "/usr/lib/python3.9/site-packages/cfnbootstrap/construction.py", line 277, in build
changes['commands'] = CommandTool().apply(
File "/usr/lib/python3.9/site-packages/cfnbootstrap/command_tool.py", line 116, in apply
commandResult = LoggingProcessHelper(
File "/usr/lib/python3.9/site-packages/cfnbootstrap/util.py", line 619, in call
results = self.process_helper.call()
File "/usr/lib/python3.9/site-packages/cfnbootstrap/util.py", line 591, in call
process = subprocess.Popen(
File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/var/app/staging/'
I know that the content of the folder contains the new version of my code, but I not manage that folder, it is managed by AWS itself with cloudformation. Any solution?
The only solution that i found was to stop the instance and wait some time. this fix the issue but another I need stop it again
Thanks