I am trying to write a generic script in AWS Cloudformation CLI that will update the stacks' parameter AMI to a new value while leaving the rest of the parameters as is.

So far, I tried doing this like so:

```
aws cloudformation update-stack --stack-name asg-xxx-123 --use-previous-template --parameters ParameterKey=ApplicationName,UsePreviousValue=true  ParameterKey=ArtefactVersion,UsePreviousValue=true ParameterKey=MachineImage,ParameterValue=ami-123

```

Notice that there are 2 parameters who are just using `UsePreviousValue=true` and only the the value of `ParameterKey=MachineImage` is the one that needs to change - this works fine. 

However, since I need it to be a generic script how can I handle the case where some stacks have more parameters than above (or even some have different parameters but still have `ParameterKey=MachineImage`)? Is there way to say only change value of `ParameterKey=MachineImage` and all the rest should be using previous value without explicitly listing in the `--parameters`?