如果我尝试使用AWS从GitHub项目运行部署到EC2实例,则从/var/log/aws/codedeploy-agent/codedeploy-agent.log获得以下错误消息
2022-08-01 11:07:25 INFO [codedeploy-agent(3386)]: master 3386: Spawned child 1/1
2022-08-01 11:07:25 INFO [codedeploy-agent(3388)]: On Premises config file does not exist or not readable
2022-08-01 11:07:25 INFO [codedeploy-agent(3388)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-2.amazonaws.com
2022-08-01 11:07:25 INFO [codedeploy-agent(3388)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Archives to retain is: 5}
2022-08-01 11:07:25 INFO [codedeploy-agent(3388)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-2.amazonaws.com
2022-08-01 11:07:25 INFO [codedeploy-agent(3388)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-2.amazonaws.com
2022-08-01 11:07:25 INFO [codedeploy-agent(3388)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.3.2-1902_deb.
2022-08-01 11:07:25 ERROR [codedeploy-agent(3388)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Missing credentials - please check if this instance was started with an IAM instance profile
2022-08-01 11:07:26 INFO [codedeploy-agent(3386)]: Started master 3386 with 1 children
2022-08-01 11:07:36 INFO [codedeploy-agent(3388)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.3.2-1902_deb.
2022-08-01 11:07:36 ERROR [codedeploy-agent(3388)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Missing credentials - please check if this instance was started with an IAM instance profile
2022-08-01 11:07:49 INFO [codedeploy-agent(3388)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.3.2-1902_deb.
2022-08-01 11:07:49 ERROR [codedeploy-agent(3388)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Missing credentials - please check if this instance was started with an IAM instance profileEC2实例分配了IAM角色:

IAM权限策略

IAM信任关系
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com",
"codedeploy.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}我尝试重新启动ec2实例并通过命令重新启动代码部署代理:
sudo service codedeploy-agent restart但这没什么用
发布于 2022-08-02 08:16:13
IAM角色缺少AmazonS3ReadOnlyAccess权限。
https://stackoverflow.com/questions/73193243
复制相似问题