InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Missing credentials
I ran into the same issue. Briefly what caused the problem:
- Launch an instance WITHOUT any roles attached to it
- Then install a codedeploy-agent on that machine
- Only lastly attach an IAM role to the machine
Result: I get the error: Missing credentials - please check if this instance was started with an IAM instance profile
Solution: restart the codedeploy agent. Use:
sudo service codedeploy-agent restart
The error should be gone now!
I was getting the "please check if this instance was started with an IAM instance profile". To check if your instance is launched without IAM profile go to AWS console -> your instance -> check in Description tab "IAM role" value, if it's empty then you have launched instance without IAM and here is what to do to solve the issue:
Go to IAM console -> Roles -> Create new role
Select AWS Service -> EC2 -> Next: Permissions(don't change anything) -> Next: Tags -> Next: Review -> Give the name and click Create role.
Go to AWS EC2 console -> select instance -> Actions -> Instance settings -> Attach/replace IAM role -> Select IAM role you just created
Restart codedeploy agent: sudo service codedeploy-agent restart
Try to deploy again and it should work
Turns out that by default Debian doesn't have curl
installed. Installing curl
before making the curl request to get the region the server is running on was the missing part in the Bash script.