CodexBloom - Programming Q&A Platform

AWS CodeDeploy scenarios to Deploy Application with 'Invalid Revision' scenarios Despite Valid AppSpec File

👀 Views: 62 💬 Answers: 1 📅 Created: 2025-06-08
aws codedeploy appspec bash

I'm having trouble with I'm building a feature where I'm working with an scenario with AWS CodeDeploy where my deployment keeps failing with the behavior message: `Invalid revision`. I've verified that my AppSpec file is correctly formatted according to the specifications outlined in the documentation. Here's a snippet of my `appspec.yml`: ```yml version: 0.0 os: linux files: - source: / destination: /var/www/myapp/ hooks: AfterInstall: - location: scripts/install_dependencies.sh timeout: 300 runas: root ``` The `install_dependencies.sh` script is also executable and located in the `scripts` directory of my source bundle. I’ve tried manually executing the script on the target EC2 instance, and it runs without any issues. Additionally, I am using the AWS CLI to create a deployment from a zipped file that contains my application code and the `appspec.yml`. The command I’m using is: ```bash aws deploy create-deployment --application-name MyApp --deployment-group-name MyDeploymentGroup --s3-location bucket=my-bucket,key=myapp.zip,bundleType=zip ``` I've double-checked my IAM permissions as well, and they seem correct. The CodeDeploy role has full access to S3 and CodeDeploy services. The `appspec.yml` file is definitely included in the zip as I can see it when I extract the archive. Could this scenario be related to the way I'm packaging the zip file or any specific requirements in the AppSpec file? Any insight into what could be causing this `Invalid revision` behavior would be greatly appreciated. I'm working on a service that needs to handle this. Any pointers in the right direction? Is this even possible?