AWS CodeDeploy error - The deployment failed because a specified file already exists at this location

1.2k Views Asked by At

i am trying to deploy the python application through code-deploy to the ec2 instances but during deployment i am facing this error

The deployment failed because a specified file already exists at this location: /home/ubuntu/yello/manage.py

attaching my appsecfile also tried with overwrite but no luck

version: 0.0
    os: linux
    files:
      - source: /
        destination: /home/ubuntu/yello
        overwrite: true
    hooks:
      AfterInstall:
    - location: script/services.sh
      timeout: 300
      runas: ubuntu

can anyone help ?

3

There are 3 best solutions below

0
shariqmaws On

This is a very common error so AWS public docs has a section for the same.

Basically when creating the deployment, you need to select Overwrite the content option so the deployment does not fail (default behaviour). Details here:

The default behaviour prevents two Deployments from two different CodeDeploy "Applications" writing the same file and possibly causing some sort of conflict.

0
Sanjoy Deb On
cd /var/www/your-directory/public/funnel_webhooks/test/

sudo rm -rf clickfunnel.txt

After removing this file please release the change in the code pipeline.

0
phpd On

Now you can specify file_exists_behavior in your appspec file. Allowed values are DISALLOW, OVERWRITE, or RETAIN.

version: 0.0
    os: linux
    files:
      - source: /
        destination: /home/ubuntu/yello
    file_exists_behavior: OVERWRITE