I did it like this:
I had several failed deployments for various reasons. The fact is that the CD is stored in the EC2 instance and in the path / opt / codedeploy-agent / deployment-root / a folder, named by the identifier of the failed deployment [very long alphanumeric sting]. Delete this folder and create a new deployment [from the aws UI console] and redeploy the application. He must now succeed.
Note. The CD does not overwrite files [that were not created by its specific deployment]
CodeDeploy is not deployed to a folder where the code [files] already exists, since it does not want to interfere with the deployment of CDs and / or other CI / CD tools [for example, Jenkins]. It is deployed only along a path that already deploys code with a specific deployment.
You can empty the folder where you want to deploy and redeploy your code using the CD.
source share