AWS CodeDeploy Fail: The deployment failed because a specified file already exists at this location

Lonergan6275 picture Lonergan6275 · Jan 11, 2017 · Viewed 12.9k times · Source

I am trying to set AWS Code deploy with Github to automate my deloyment. the problem i am having is the ec2 instance is already active and has the web app code. the problem is there is also other content on the instance that I don't want under source control. Code deploy is failing with the following error:

The deployment failed because a specified file already exists at this location

this is because the source code is on the instance and was not added as a revision.

So my question is there any way to make the code deploy recognise the current files on the instance as an inital revision?

Answer

Seirddriezel picture Seirddriezel · Jun 26, 2017

This is possible! This is an option during a deployment: "Content options: Choose the action for AWS CodeDeploy to take during a deployment when a file on a target instance has the same name as a file in the application revision, for the same target location."

You can choose fail, overwrite and retain. Retain is probably the best choice in your case.

You can find more information