How to add "Overwrite the content" in codedeploy via cloudformation template
I template is fine and running but when i'm trying to deploy new version it's giving me different errors.
Such as below
- The deployment failed because a specified file already exists at this location. I did deleted the whole folder.
- Script at specified location: scripts/app_stop.sh run as user root failed with exit code 1
LifecycleEvent - ApplicationStop Script - scripts/app_stop.sh [stderr]Unknown operation 'httpd'.
I have the httpd up and running.
Edit- I have specified "IgnoreApplicationStopFailures: true" already in my DeploymentGroup Resources section.
Edit- My app_stop.sh looks like below -
if [ -d /var/www/html/scripts ]; then
sudo rm -Rf /var/www/html/* /opt/codedeploy-agent/deployment-root/*
fi
isExistApp=`pgrep httpd`
if [[ -n $isExistApp ]]; then
sudo systemctl stop httpd
fi
Edit - Added the template to be changed.
Group:
Type: AWS::CodeDeploy::DeploymentGroup
Properties:
ApplicationName: !ImportValue DeployName
Deployment:
IgnoreApplicationStopFailures: true
Description: 'Code Deploy to Train'
Revision:
RevisionType: S3
S3Location:
Bucket: '<sample>'
BundleType: 'zip'
Key: '<test>.zip'
Ec2TagFilters:
-
Key: 'Type'
Value: 'Train'
Type: 'KEY_AND_VALUE'
ServiceRoleArn: !GetAtt [PipeRole, Arn]
I would be needing the to use the below options with the Overwrite feature alongside this template.