简体   繁体   English

AWS SAM:调用 CreateChangeSet 操作时发生错误 (ValidationError):参数“MaxAllowedPacket”必须是数字

[英]AWS SAM: An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameter 'MaxAllowedPacket' must be a number

I am adding a new parameter to my AWS RDS aurora-mysql CloudFormation template.我正在向我的 AWS RDS aurora-mysql CloudFormation 模板添加一个新参数。 But I am getting following error when running sam deploy .但是我在运行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: product.yaml 片段:

  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.我已将MaxAllowedPacket的类型设置为带有数字最小值最大值Number ,默认值也是数字。 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所以不清楚为什么会抛出此错误: 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 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.我确实看过 SO 上的其他类似帖子,例如this ,但没有帮助。

I found the issue.我发现了问题。 This was happening because I had earlier defined MaxAllowedPacket as String and had created the resource with that.发生这种情况是因为我之前将MaxAllowedPacket定义为String并使用它创建了资源。

Old Code:旧代码:

  MaxAllowedPacket:
    AllowedPattern: ^(Auto|102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-9][0-9]{4,8}|10[0-6][0-9]{7}|107[0-2][0-9]{6}|1073[0-6][0-9]{5}|10737[0-3][0-9]{4}|1073740[0-9]{3}|1073741[0-7][0-9]{2}|10737418[01][0-9]|107374182[0-4])$
    Default: Auto
    Description: >-
      This parameter indicates the maximum size of packet in bytes. The default value is 4194304 (4 MB).
      Allowed values are between 1024 to 1073741824, or "Auto" to use the default value
    Type: String

After changing it to Number , it was failing when trying to update the same CloudFormation Stack because that Stack was having MaxAllowedPacket as String.将其更改为Number后,尝试更新相同的 CloudFormation 堆栈时失败,因为该堆栈将MaxAllowedPacket作为字符串。 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.为确保这是问题所在,我使用我的新代码(如此处的问题所示)创建了一个新的 CF 堆栈(并因此创建了新资源)并且它运行良好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS timestream-write 获取“调用 DescribeEndpoints 操作时发生错误 (AccessDeniedException):不允许执行此操作。” - AWS timestream-write gets "An error occurred (AccessDeniedException) when calling the DescribeEndpoints operation: This operation is not allowed." 调用 DescribeTaskDefinition 操作时发生错误(ClientException) - An error occurred (ClientException) when calling the DescribeTaskDefinition operation 调用 DescribeLaunchTemplates 操作时发生错误(UnauthorizedOperation)? - An error occurred (UnauthorizedOperation) when calling the DescribeLaunchTemplates operation? AWS Lambda:调用 GetObject 操作时发生错误 (NoSuchKey):指定的键不存在 - AWS Lambda: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist 调用 PutSubscriptionFilter 操作时发生错误(InvalidParameterException) - An error occurred (InvalidParameterException) when calling the PutSubscriptionFilter operation golang aws CreateChangeSet 验证错误 - golang aws CreateChangeSet validation error AWS S3 Boto3 Python - 调用 DeleteObject 操作时发生错误 (AccessDenied):拒绝访问 - AWS S3 Boto3 Python - An error occurred (AccessDenied) when calling the DeleteObject operation: Access Denied AWS Lambda python boto3 dynamodb 表扫描 - 调用扫描操作时发生错误(ValidationException):ExpressionAttributeNames - AWS Lambda python boto3 dynamodb table scan - An error occurred (ValidationException) when calling the Scan operation: ExpressionAttributeNames AWS System Manager 启动 session:调用 StartSession 操作时发生错误 (TargetNotConnected):<instance_id> 未连接</instance_id> - AWS System Manager start session: An error occurred (TargetNotConnected) when calling the StartSession operation: <instance_id> is not connected AWS CLI S3 调用 HeadObject 操作时发生客户端错误 (403):禁止访问 - AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM