0
votes

Question I am running a create-change-set command, which will lookup a parameters file, but i am getting a CLI error message

Code

aws cloudformation create-change-set --stack-name  arn:aws:cloudformation:eu-west-1:xxxxxxxxxxxxxx:stack/JM-MachineLearning/0846dff0-5f91-11e9-8422-0a9391483dc6 --template-body packaged.yaml --parameters teststackupdate.json --change-set-name SampleChangeSet2 

Error message

Parameter validation failed:
Invalid type for parameter Parameters[0].UsePreviousValue, value: true, type: <type 'unicode'>, valid types: <type 'bool'>
Invalid type for parameter Parameters[1].UsePreviousValue, value: true, type: <type 'unicode'>, valid types: <type 'bool'>
Invalid type for parameter Parameters[2].UsePreviousValue, value: true, type: <type 'unicode'>, valid types: <type 'bool'>
Invalid type for parameter Parameters[3].UsePreviousValue, value: true, type: <type 'unicode'>, valid types: <type 'bool'>
Invalid type for parameter Parameters[4].UsePreviousValue, value: true, type: <type 'unicode'>, valid types: <type 'bool'>

File

cat teststackupdate.json
[
        {
                "ParameterKey": "DeploymentName",
                "UsePreviousValue": "true"
        },
        {
                "ParameterKey": "KinesisName",
                "UsePreviousValue": "true"
        },
        {
                "ParameterKey": "serverName",
                "UsePreviousValue": "true"
        },
        {
                "ParameterKey": "LambdaFunctionName",
                "UsePreviousValue": "true"
        },
        {
                "ParameterKey": "LambdaTimeout",
                "UsePreviousValue": "true"
        },
        {
                "ParameterKey": "payloadBucketName",
                "UsePreviousValue": "true"
        },
        {
                "ParameterKey": "nameTableEvent",
                "UsePreviousValue": "true"
        }
]

What i am trying to do it, update the stack in AWS Cloudformation. I created the stack via CLI from SAM, and convereted into Cloudformation and then deployed.

I did run the command via CLI, but this also didn't work ParameterKey=string,ParameterValue=string,UsePreviousValue=boolean,ResolvedValue=string

Running the parameters via CLI

aws cloudformation create-change-set --stack-name arn:aws:cloudformation:eu-west-1:xxxxxxxxxxx:stack/JM-MachineLearning/0846dff0-5f91-11e9-8422-0a9391483dc6 --change-set-name SampleChangeSet2  --parameter LambdaFunctionName=MachineLearningMementoDynamoDBSaver nameTableEvent=MachineLearningEvent nameTableCountersEvent=MachineLearningCountersEventId nameTableCountersEventRowId=MachineLearningCountersEventRowId serverName=LambdaMachineLearning KinesisName=MachineLearningDataStream payloadBucketName=redcloud-machinelearning-6888/memento/error-payload --profile DEV  --region eu-west-1

Parameter validation failed:
Unknown parameter in Parameters[0]: "LambdaFunctionName", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue
Unknown parameter in Parameters[1]: "nameTableEvent", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue
Unknown parameter in Parameters[2]: "nameTableCountersEvent", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue
Unknown parameter in Parameters[3]: "nameTableCountersEventRowId", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue
Unknown parameter in Parameters[4]: "serverName", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue
Unknown parameter in Parameters[5]: "KinesisName", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue
Unknown parameter in Parameters[6]: "payloadBucketName", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue

Any advice will be appericated.

I am new to Cloudformation/SAM.

Thanks

1

1 Answers

1
votes

Edit: On second thought, this may not be your issue - but do try and see if the error changes. Hopefully someone else can provide a better answer.

In your teststackupdate.json, you have:

"UsePreviousValue": "true"

Your true is in quotes, making it a string. The error is telling you it needs to be boolean, which is true/false.

Unquote all the "true" so that it looks like:

"UsePreviousValue": true