我正在设置一个bash脚本,该脚本在提交时验证yaml模板。无法使validate-template命令通过命令行传递
运行此命令:
aws cloudformation validate-template --template-body file:///myPath/serverless.yml
的背景
在其他yml文件上运行正常。
我收到的错误是:
调用ValidateTemplate时发生错误(ValidationError) 操作:无效的模板属性或属性[功能, 提供者,服务,习惯,资源]
service: Shortstop-CloudFront-Failover
provider:
name: aws
runtime: python2.7
timeout: 180
memorySize: 1024
stackTags:
name: Build and Release Engineering
product_name: Infrastructure
iamRoleStatements:
- Effect: "Allow"
Action:
- cloudfront:*
Resource: '*'
- Effect: "Allow"
Action:
- cloudformation:ListExports
Resource: '*'
custom:
commonStack: CSE-Common
cloudFrontStack: Shortstop-Cloudfront-${opt:stage}
domainQualifier: cdn-shortstop
functions:
cloudfrontFailover:
handler: failover.lambda_handler
environment:
CDN_DOMAIN_EXP_NAME: ${self:custom.cloudFrontStack}-CDN-Domain
CDN_DISTRIBUTION_EXP_NAME: ${self:custom.cloudFrontStack}-Distribution
NET_ZONE_NAME_EXP_NAME: ${self:custom.commonStack}-NetZoneName
INACTIVE_PRIMARY_DOMAIN: inactive-primary-${self:custom.domainQualifier}
INACTIVE_BACKUP_DOMAIN: inactive-backup-${self:custom.domainQualifier}
PRIMARY_REGION: us-east-1
BACKUP_REGION: us-west-2
resources:
Resources:
# Subscribes the lambda function to the SNS topic
# This is what will trigger the lambda function
failoverSubscription:
Type: AWS::SNS::Subscription
Properties:
Endpoint: {"Fn::GetAtt": [CloudfrontFailoverLambdaFunction, Arn]}
Protocol: lambda
TopicArn: ${opt:alarm-arn}
# Policy that allows the lambda function to be invoked by the SNS subscription
subscribeAlarmPolicy:
Type: AWS::Lambda::Permission
Properties:
FunctionName: {"Fn::GetAtt": [CloudfrontFailoverLambdaFunction, Arn]}
Action: "lambda:InvokeFunction"
Principal: "sns.amazonaws.com"
SourceArn: ${opt:alarm-arn}```