aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.48k stars 4.11k forks source link

Allow cloudformation deploy to use existing template #4016

Open hoegertn opened 5 years ago

hoegertn commented 5 years ago

It would really be cool if I could advice aws cloudformation deploy to use the current template instead of specifying a new one. So I could do parameter updates with a single command and only specify the changed parameter.

dstufft commented 5 years ago

Marking this as a feature request. Thanks!

jrm2k6 commented 4 years ago

Is there an update for this? Updating stacks parameters through the cli seems to be tedious as in this case you have to specific a full template, even if you care only about updating parameters. If you think about using update-stack, you still have to fetch all the existing parameters as there is no option to only pass the parameters you want to override or new parameters. In either case, it is adding an extra step for what should be a simple update from a consumer perspective, unless I am missing something?

jk2l commented 2 years ago

+1 on this, i have to write a custom bash script to flag maintenance mode on/off

summary=$(aws cloudformation get-template-summary --stack-name ${TARGET_STACK} )
parameters=($(echo $summary | jq -r '.Parameters[].ParameterKey' | grep -v MaintenanceMode))
parameters=$(printf "ParameterKey=%s,UsePreviousValue=true " "${parameters[@]}")
parameters=$(echo "${parameters} ParameterKey=MaintenanceMode,ParameterValue=${bamboo_MAINTENANCE_MODE}")

aws cloudformation update-stack \
              --stack-name ${TARGET_STACK} \
              --use-previous-template \
              --capabilities CAPABILITY_NAMED_IAM \
              --parameters $parameters

aws cloudformation wait stack-update-complete --stack-name ${TARGET_STACK}

I would like to see much simple option like

aws cloudformation deploy --use-previous-template --parameter-override MaintenanceMode=On

This is a bit ridiculous that one feature (use-previous-template) support in update-stack but not in deploy, and then parameter-override support in deploy but not in update-stack. so we have to choose either re-upload whole template everytime we run "deploy" or specify all parameters again in update-stack