CodeDeploy 실패 원인은 많지만, Console에서는 event log도 없고 그냥 EC2 Fail만 뜨는 경우도 있다.

 이럴 경우에는 다음의 위치에서 EC2 CodeDeploy Agent Log를 확인하면된다.

 보통 이럴 경우는 Deploy 전에 실패라서, Agent와 Console과의 소통 문제이기에,

 Agent Log를 보면 된다.

 LOG 위치: /var/log/aws/codedeploy-agent/codedeploy-agent.log

 LOG 내용: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Missing credentials - please check if this instance was started with an IAM instance profile

 조치 방법: sudo service codedeploy-agent restart
 
 Fail 원인: EC2에 CodeDeploy 관련 IAM Role이 부여되기 전에 CodeDeploy Agent가 실행되면서 IAM Role을 못 가져간 것.
 
 예방: EC2의 IAM Role이 바뀌면 CodeDeploy Agent restart를 수행한다.
 
 관련 링크: https://stackoverflow.com/questions/41997426/instanceagentpluginscodedeployplugincommandpoller-missing-credentials