Please ensure the below things, me too had same error.
Install or reinstall the CodeDeploy agent for Amazon Linux or RHEL
sudo yum update
sudo yum install ruby
sudo yum install wget
chmod +x ./install
sudo ./install auto
Policy for EC2InstanceProfileIAMRole
Policy for CodeDeployServiceROle
I guess you are having your code on your S3 Bucket, if please mention it revision name as below given in codedeploy deployment section.
Note: Not full permission recommended i belive you are experimenting in you lab.