Elastic Beanstalk 部署 - 验证环境服务角色的权限

问题描述 投票:0回答:1

我正在使用 Laravel 8 应用程序并尝试使用 Elastic beanstalk 来部署它。有一天,在没有任何警告的情况下,我收到了以下错误,但我似乎根本无法弄清楚。它甚至难倒了AWS的支持。我已经尝试了几乎所有方法以及我不断看到的建议,以确保安全部分的权限有效。

这些是我看到的设置,我不断在两者之间切换并添加/删除权限,以尝试使其与任一设置一起工作,运气为零。我也尝试过克隆和重建,但没有成功。

目前我对服务角色拥有以下权限:

EC2 角色如下:

Elastic Beanstalk 错误: 健康检查失败。请验证环境服务角色的权限,然后重试。权限更改最多需要两个小时才能传播。

此处还包含日志文本:

----------------------------------------
/var/log/eb-engine.log
----------------------------------------
2021/06/03 14:08:39.967837 [INFO] Running command /bin/sh -c systemctl daemon-reload
2021/06/03 14:08:40.048241 [INFO] Running command /bin/sh -c systemctl reset-failed
2021/06/03 14:08:40.052686 [INFO] Running command /bin/sh -c systemctl is-enabled aws-eb.target
2021/06/03 14:08:40.056696 [INFO] Running command /bin/sh -c systemctl enable aws-eb.target
2021/06/03 14:08:40.136288 [INFO] Running command /bin/sh -c systemctl start aws-eb.target
2021/06/03 14:08:40.141001 [INFO] Running command /bin/sh -c systemctl enable healthd.service
2021/06/03 14:08:40.220221 [INFO] Running command /bin/sh -c systemctl show -p PartOf healthd.service
2021/06/03 14:08:40.225894 [INFO] Running command /bin/sh -c systemctl is-active healthd.service
2021/06/03 14:08:40.229958 [INFO] Running command /bin/sh -c systemctl start healthd.service
2021/06/03 14:08:40.251790 [INFO] Copying file /opt/elasticbeanstalk/config/private/healthd/healthd_logformat.conf to /var/proxy/staging/nginx/conf.d/healthd_logformat.conf
2021/06/03 14:08:40.253224 [INFO] Copying file /opt/elasticbeanstalk/config/private/healthd/healthd_nginx.conf to /var/proxy/staging/nginx/conf.d/elasticbeanstalk/healthd.conf
2021/06/03 14:08:40.255003 [INFO] Executing instruction: configure php-fpm
2021/06/03 14:08:40.260685 [INFO] Executing instruction: configure log streaming
2021/06/03 14:08:40.260695 [INFO] log streaming is not enabled
2021/06/03 14:08:40.260699 [INFO] disable log stream
2021/06/03 14:08:40.260712 [INFO] Running command /bin/sh -c systemctl show -p PartOf amazon-cloudwatch-agent.service
2021/06/03 14:08:40.270003 [INFO] Running command /bin/sh -c systemctl stop amazon-cloudwatch-agent.service
2021/06/03 14:08:40.275398 [INFO] Executing instruction: GetToggleForceRotate
2021/06/03 14:08:40.275422 [INFO] Checking if logs need forced rotation
2021/06/03 14:08:40.275441 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:539550674720:stack/awseb-e-nssafrgize-stack/a1fd7df0-9330-11eb-8d1c-0edd3867f3f1 -r AWSEBAutoScalingGroup --region us-east-1
2021/06/03 14:08:40.895708 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:539550674720:stack/awseb-e-nssafrgize-stack/a1fd7df0-9330-11eb-8d1c-0edd3867f3f1 -r AWSEBBeanstalkMetadata --region us-east-1
2021/06/03 14:08:41.486133 [INFO] Procfile not found. Generating default rsyslog config
2021/06/03 14:08:41.487637 [INFO] Running command /bin/sh -c systemctl restart rsyslog.service
2021/06/03 14:08:41.511223 [INFO] Executing instruction: PostBuildEbExtension
2021/06/03 14:08:41.511252 [INFO] Starting executing the config set Infra-EmbeddedPostBuild.
2021/06/03 14:08:41.511266 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-1:539550674720:stack/awseb-e-nssafrgize-stack/a1fd7df0-9330-11eb-8d1c-0edd3867f3f1 -r AWSEBAutoScalingGroup --region us-east-1 --configsets Infra-EmbeddedPostBuild
2021/06/03 14:08:41.894764 [INFO] Finished executing the config set Infra-EmbeddedPostBuild.

2021/06/03 14:08:41.894795 [INFO] Executing instruction: CleanEbExtensions
2021/06/03 14:08:41.894818 [INFO] Cleaned ebextensions subdirectories from app staging directory.
2021/06/03 14:08:41.894836 [INFO] Executing instruction: RunAppDeployPreDeployHooks
2021/06/03 14:08:41.894846 [INFO] The dir .platform/hooks/predeploy/ does not exist in the application. Skipping this step...
2021/06/03 14:08:41.894851 [INFO] Executing instruction: stop X-Ray
2021/06/03 14:08:41.894855 [INFO] stop X-Ray ...
2021/06/03 14:08:41.894868 [INFO] Running command /bin/sh -c systemctl show -p PartOf xray.service
2021/06/03 14:08:41.902075 [WARN] stopProcess Warning: process xray is not registered 
2021/06/03 14:08:41.902095 [INFO] Running command /bin/sh -c systemctl stop xray.service
2021/06/03 14:08:41.909722 [INFO] Executing instruction: stop proxy
2021/06/03 14:08:41.909742 [INFO] Running command /bin/sh -c systemctl show -p PartOf httpd.service
2021/06/03 14:08:41.917202 [WARN] deregisterProcess Warning: process httpd is not registered, skipping...

2021/06/03 14:08:41.917224 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2021/06/03 14:08:41.923452 [WARN] deregisterProcess Warning: process nginx is not registered, skipping...

2021/06/03 14:08:41.923466 [INFO] Executing instruction: stop php-fpm
2021/06/03 14:08:41.923477 [INFO] Running command /bin/sh -c systemctl show -p PartOf php-fpm.service
2021/06/03 14:08:41.928491 [WARN] stopProcess Warning: process php-fpm is not registered 
2021/06/03 14:08:41.928520 [INFO] Running command /bin/sh -c systemctl stop php-fpm.service
2021/06/03 14:08:41.933414 [INFO] Executing instruction: FlipApplication
2021/06/03 14:08:41.933806 [INFO] create soft link from /var/app/current/ to /var/www/html
2021/06/03 14:08:41.933835 [INFO] Executing instruction: start X-Ray
2021/06/03 14:08:41.933841 [INFO] X-Ray is not enabled.
2021/06/03 14:08:41.933846 [INFO] Executing instruction: start php-fpm
2021/06/03 14:08:41.933987 [INFO] Running command /bin/sh -c systemctl show -p PartOf php-fpm.service
2021/06/03 14:08:41.942554 [INFO] Running command /bin/sh -c systemctl daemon-reload
2021/06/03 14:08:42.028789 [INFO] Running command /bin/sh -c systemctl reset-failed
2021/06/03 14:08:42.033188 [INFO] Running command /bin/sh -c systemctl show -p PartOf php-fpm.service
2021/06/03 14:08:42.038374 [INFO] Running command /bin/sh -c systemctl is-active php-fpm.service
2021/06/03 14:08:42.041918 [INFO] Running command /bin/sh -c systemctl start php-fpm.service
2021/06/03 14:08:42.172017 [INFO] Executing instruction: start proxy with new configuration
2021/06/03 14:08:42.172049 [INFO] Running command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf
2021/06/03 14:08:42.198193 [INFO] Running command /bin/sh -c cp -rp /var/proxy/staging/nginx/* /etc/nginx
2021/06/03 14:08:42.200700 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2021/06/03 14:08:42.207540 [INFO] Running command /bin/sh -c systemctl daemon-reload
2021/06/03 14:08:42.283504 [INFO] Running command /bin/sh -c systemctl reset-failed
2021/06/03 14:08:42.287860 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2021/06/03 14:08:42.293123 [INFO] Running command /bin/sh -c systemctl is-active nginx.service
2021/06/03 14:08:42.296696 [INFO] Running command /bin/sh -c systemctl start nginx.service
2021/06/03 14:08:42.335235 [INFO] Executing instruction: configureSqsd
2021/06/03 14:08:42.335251 [INFO] This is a web server environment instance, skip configure sqsd daemon ...
2021/06/03 14:08:42.335256 [INFO] Executing instruction: startSqsd
2021/06/03 14:08:42.335260 [INFO] This is a web server environment instance, skip start sqsd daemon ...
2021/06/03 14:08:42.335264 [INFO] Executing instruction: Track pids in healthd
2021/06/03 14:08:42.335269 [INFO] This is an enhanced health env...
2021/06/03 14:08:42.335282 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf aws-eb.target | cut -d= -f2
2021/06/03 14:08:42.342372 [INFO] cfn-hup.service php-fpm.service healthd.service nginx.service

2021/06/03 14:08:42.342398 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf eb-app.target | cut -d= -f2
2021/06/03 14:08:42.347355 [INFO] 

2021/06/03 14:08:42.347479 [INFO] Executing instruction: RunAppDeployPostDeployHooks
2021/06/03 14:08:42.347492 [INFO] The dir .platform/hooks/postdeploy/ does not exist in the application. Skipping this step...
2021/06/03 14:08:42.347496 [INFO] Executing cleanup logic
2021/06/03 14:08:42.347636 [INFO] Platform Engine finished execution on command: self-startup

2021/06/03 18:20:32.502185 [INFO] Starting...
2021/06/03 18:20:32.502245 [INFO] Starting EBPlatform-PlatformEngine
2021/06/03 18:20:32.502262 [INFO] reading event message file
2021/06/03 18:20:32.502366 [INFO] no eb envtier info file found, skip loading env tier info.
2021/06/03 18:20:32.502438 [INFO] Engine received EB command cfn-hup-exec

2021/06/03 18:20:32.709872 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:539550674720:stack/awseb-e-nssafrgize-stack/a1fd7df0-9330-11eb-8d1c-0edd3867f3f1 -r AWSEBAutoScalingGroup --region us-east-1
2021/06/03 18:20:33.065405 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:539550674720:stack/awseb-e-nssafrgize-stack/a1fd7df0-9330-11eb-8d1c-0edd3867f3f1 -r AWSEBBeanstalkMetadata --region us-east-1
2021/06/03 18:20:33.410133 [INFO] checking whether command tail-log is applicable to this instance...
2021/06/03 18:20:33.410147 [INFO] this command is applicable to the instance, thus instance should execute command
2021/06/03 18:20:33.410151 [INFO] Engine command: (tail-log)

2021/06/03 18:20:33.411133 [INFO] Executing instruction: GetTailLogs
2021/06/03 18:20:33.411140 [INFO] Tail Logs...
2021/06/03 18:20:33.412111 [INFO] Running command /bin/sh -c tail -n 100 /var/log/eb-engine.log
laravel amazon-web-services amazon-ec2 amazon-elastic-beanstalk amazon-iam
1个回答
0
投票

太晚了,但我希望它对其他人有帮助。根据我的发现,这种行为的主要原因是:

"Unable to assume role "arn:aws:iam::xxxxxx:role/aws-elasticbeanstalk-service-role". Verify that the role exists and is configured correctly."

尽管拥有足够的权限,但 Elastic Beanstalk (EBS) 环境由于某种原因无法承担默认的“aws-elasticbeanstalk-service-role”。解决方案是创建一个具有类似于“aws-elasticbeanstalk-service-role”权限的新服务角色,并将 Elastic Beanstalk 环境的服务角色配置为使用此自定义角色。

在我的例子中,环境的运行状况正在转换为“暂停”状态,因为 Elastic Beanstalk 无法访问环境的服务角色来监控运行状况,从而导致部署停止。

© www.soinside.com 2019 - 2024. All rights reserved.