![](/img/trans.png)
[英]AWS timestream-write gets "An error occurred (AccessDeniedException) when calling the DescribeEndpoints operation: This operation is not allowed."
[英]AWS SAM: An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameter 'MaxAllowedPacket' must be a number
我正在向我的 AWS RDS aurora-mysql CloudFormation 模板添加一个新参数。 但是我在运行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 片段:
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
我已将MaxAllowedPacket
的类型设置为带有数字最小值和最大值的Number
,默认值也是数字。 所以不清楚为什么会抛出此错误: 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
我确实看过 SO 上的其他类似帖子,例如this ,但没有帮助。
我发现了问题。 发生这种情况是因为我之前将MaxAllowedPacket
定义为String
并使用它创建了资源。
旧代码:
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
将其更改为Number
后,尝试更新相同的 CloudFormation 堆栈时失败,因为该堆栈将MaxAllowedPacket
作为字符串。 为确保这是问题所在,我使用我的新代码(如此处的问题所示)创建了一个新的 CF 堆栈(并因此创建了新资源)并且它运行良好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.