Reputation: 11
I am trying to update a custom parameter on CloudFormation nested stack from console. It is updated but after code deployment, it gets default value. I want to save last updated value after deployment. I used a bash script as a build command on buildspec.yml. It works if there is a stack but does not work for a stack + a nested stack. Does anyone have any idea about it? I want to use this for updating a parameter from console without code deployment and save it for further usage if it is not changed.
publish.sh
mkdir -p build
# SAM Package
aws cloudformation package --template template-build.yml --s3-bucket ${DEPLOYMENT_BUCKET} --output-template build/template.yml --debug
# SAM Deploy
aws cloudformation deploy --template-file build/template.yml --stack-name ${STACK_NAME} --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND --role-arn ${ROLE_ARN} \
--s3-bucket $DEPLOYMENT_BUCKET \
--parameter-overrides \
DeploymentBucketName=${DEPLOYMENT_BUCKET} \
NodeModulesZipFileName=${packageJsonHash}.zip
buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
nodejs: 10
commands:
- yum install python3-pip -y
- whereis pip
- pip3 install aws-sam-cli --upgrade --user
- pip3 install awscli --upgrade --user
pre_build:
commands:
- mkdir -p build/
build:
commands:
- echo Build started on `date`
- npm install --only=prod
- chmod +x publish.sh
- bash publish.sh
post_build:
commands:
- echo "no post build needed..."
artifacts:
type: zip
files:
- build/template.yml
Upvotes: 0
Views: 256