问题描述
模板格式错误:YAML 格式不正确。 (第 30 行,第 36 列)。请帮我。错误出现在 FilterPattern 行
AWstemplateFormatVersion: "2010-09-09"
Resources:
MySNSTopic:
Type: AWS::SNS::Topic
Properties:
Subscription:
- Endpoint: "abcd@abcd.com"
Protocol: email
snstopic:
Type: AWS::Logs::LogGroup
DependsOn: MySNSTopic
Properties:
RetentionInDays: 7
UnauthorizedApiCalls:
Type: AWS::Logs::MetricFilter
DependsOn: snstopic
Properties:
LogGroupName:
Ref: "snstopic"
FilterPattern: "{($.errorCode="*UnauthorizedOperation") || ($.errorCode="AccessDenied*")}"
MetricTransformations:
-
MetricValue: "1"
MetricNamespace: "unauthorized-api-calls"
MetricName: "LogMetrics"
解决方法
你应该使用单引号:
FilterPattern: '{($.errorCode="*UnauthorizedOperation") || ($.errorCode="AccessDenied*")}'