Issue
I am using Windows 11.
I am trying to deploy my WordPress blog on EC2 using CodeDeploy agent and S3 bucket. I am following this tutorial: href="https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials-wordpress.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials-wordpress.html
All went well until the last step - creation of deployment using the command:
aws deploy create-deployment --application-name WordPress_App --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name WordPress_DepGroup --s3-location bucket=bucketname,bundleType=zip,key=WordPressApp.zip
The deployment failed with the error message:
LifecycleEvent - BeforeInstall
Script - scripts/install_dependencies.sh
[stderr]bash: line 1: /opt/codedeploy-agent/deployment-root/0fe44b8b-fa1d-4791-a920-a4ce3fd9ad4f/d-7NOGWJZJ1/deployment-archive/
scripts/install_dependencies.sh: cannot execute: required file not found
I suspect it is because after unpacking the zip file with the source code the CodeDeploy agent doesn't have proper rights on Linux (my EC2 instance is Linux distribution) to access the install_dependencies.sh file that I manually created before on my Windows machine. I had to effectively skip one point in the tutorial
Give all of the scripts executable permissions. On the command line,
type: chmod +x /tmp/WordPress/scripts/*
as the chmod does not exist on Windows (the whole file/permissions system is different on Windows).
What can I do?
Solution
The line endings were the problem. Make sure that when you push from Windows to EC2 Linux instance your line endings are of Unix type and not CRLF.
Answered By - kukis Answer Checked By - Katrina (WPSolving Volunteer)