Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Code Deploy Error on Before Install Cannot Solve

So I am attempting to setup CodeDeploy for my application and I keep getting an error during the BeforeInstall part of the deployment. Below is the error.

Error Code UnknownError
Script Name
Message No such file or directory - /opt/codedeploy-agent/deployment-root/06100f1b-5495-42d9-bd01-f33d59fb5deb/d-NL5K1THE8/deployment-archive/appspec.yml
Log Tail

I assumed this meant the YAML file was in the wrong place. However it is in the root directory of my revision. I have tried using a simple AppSpec file like so instead of a more complex one.

    ## YAML Template.
---
version: 0.0
os: linux
files:
  - source: /
    destination: /home/ubuntu/www

More or less since this is a first deployment I want it to add all files in the revision to the public directory on the web server.

I am tearing my hair out over this and I feel it is a simple issue. I have the IAM policies and roles correct and I have CodeDeploy setup and running on my instance I am trying to deploy to.

like image 636
wmfrancia Avatar asked Apr 20 '15 16:04

wmfrancia


People also ask

What should be checked first when an AWS CodeDeploy deployment fails?

Check the format of your AppSpec file. For more information, see Add an application specification file to a revision for CodeDeploy and CodeDeploy AppSpec File reference. Check your Amazon S3 bucket or GitHub repository to verify your application revision is in the expected location.

How do I remove AWS Deploy code?

To delete the CodeDeploy deployment component recordsIn the navigation pane, expand Deploy, then choose Applications. Choose CodeDeployGitHubDemo-App. Choose Delete application. When prompted, enter Delete , and then choose Delete.

How do you check if code Deploy agent is running?

If the command returns an error, the CodeDeploy agent is not installed. Install it as described in Install the CodeDeploy agent for Ubuntu Server. If the CodeDeploy agent is installed and running, you should see a message like The AWS CodeDeploy agent is running .

What is the timeout before a deployment fails if a lifecycle event doesn't start after the previous lifecycle event is completed?

If this happens, the deployment fails, even if a deployment process is otherwise running as expected. The default timeout for a script in a lifecycle event is 30 minutes.


2 Answers

It seems to think you had a successful deploy at some point.

Go into /opt/codedeploy-agent/deployment-root/deployment-instructions/ and delete all the files in there. Then it won't look for this last deploy.

like image 116
Levitron Avatar answered Oct 11 '22 09:10

Levitron


I just had this SAME problem and I figured it out! Make sure your AppSpec file has the right EXTENSION! I was using yaml and not yml, now everything works perfectly.

like image 41
redband Avatar answered Oct 11 '22 10:10

redband