I am adding a new parameter to my AWS RDS aurora-mysql CloudFormation template. But I am getting following error when running sam deploy
.
sam deploy \
--region us-west-2 \
--stack-name xxxx \
--template-file build/product.yaml \
--capabilities CAPABILITY_IAM \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
VpcId=vpc-123456789 \
LambdaCodeBucket=artifacts-123456789
Deploying with following values
===============================
Stack name : xxxx
Region : us-west-2
Confirm changeset : False
Deployment s3 bucket : None
Capabilities : ["CAPABILITY_NAMED_IAM"]
Parameter overrides : {"VpcId": "vpc-123456789", "LambdaCodeBucket": "artifacts-123456789"}
Signing Profiles : {}
Initiating deployment
=====================
Error: Failed to create changeset for the stack: xxxx, An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameter 'MaxAllowedPacket' must be a number.
make: *** [deploy] Error 1
product.yaml snippet:
MaxAllowedPacket:
Description: >-
This parameter indicates the maximum size of packet in bytes. Allowed values are between 1024 to 1073741824.
The default value is 4194304 (4 MB).
Type: Number
MinValue: 1024
MaxValue: 1073741824
Default: 4194304
....
Resources:
...
DBParameterGroup:
Type: AWS::RDS::DBParameterGroup
Properties:
Description: !Ref AWS::StackName
Family: aurora-mysql5.7
Parameters:
max_allowed_packet: !Ref MaxAllowedPacket
I have set the type for MaxAllowedPacket
as Number
with a numeric min and max and the default value is also numeric. So not clear why is it throwing this error: Error: Failed to create changeset for the stack: xxxx, An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameter 'MaxAllowedPacket' must be a number. make: *** [deploy] Error 1
I did look at other similar post on SO such as this, but it did not help.
I found the issue. This was happening because I had earlier defined
MaxAllowedPacket
asString
and had created the resource with that.Old Code:
After changing it to
Number
, it was failing when trying to update the same CloudFormation Stack because that Stack was havingMaxAllowedPacket
as String. To ensure this was the issue, I created a new CF Stack (and hence new resource) with my new code (as shown on the question here) and it worked fine.