AWS CodeDeploy错误:部署失败,因为此位置已存在指定的文件

问题描述:

我正在尝试使用Github设置AWS Code部署以自动执行我的部署。我遇到的问题是ec2实例已经处于活动状态并且具有Web应用程序代码。问题是实例上还有其他我不想在源代码控制下的内容。
代码部署失败,并出现以下错误:

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?

这是可能的!这是部署期间的一个选项:内容选项:
选择在目标实例上的文件与应用程序修订版中的文件具有相同名称的目标实例上的文件时,在部署期间对AWS CodeDeploy采取的操作位置。

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.

您可以找到更多信息

cli docs.aws.amazon.com (请参阅--file-exists-behavior (字符串))

cli docs.aws.amazon.com (see --file-exists-behavior (string))