模型验证失败(#/EventSourceArn:关键字 [模式] 的验证约束失败)

NIr*_*odi 9 amazon-web-services aws-cloudformation

在AWS云形成中,我面临以下验证错误:

Model validation failed (#/EventSourceArn: failed validation constraint for keyword [pattern])
Run Code Online (Sandbox Code Playgroud)

canary.yaml

Canary:
    Type: AWS::Synthetics::Canary
    Properties:
      Name:
        Fn::Sub: test12345678901234567889-development
      Code:
        Handler: exports.handler
        Script: |
          const https = require('https')
          const URL = process.env.URL;
          var synthetics = require('Synthetics');
          const log = require('SyntheticsLogger');
          log.info('URL:'+URL);
          exports.handler = async function(event) {
            const promise = new Promise(function(resolve, reject) {
              https.get(URL, (res) => {
                  resolve(res.statusCode)
                }).on('error', (e) => {
                  reject(Error(e))
                })
              })
            return promise
          }
      ExecutionRoleArn:
        Fn::GetAtt:
          - CloudWatchSyntheticsRole
          - Arn
      RuntimeVersion: syn-nodejs-puppeteer-3.2
      RunConfig:
        TimeoutInSeconds: 60
        EnvironmentVariables:
          URL : !Sub "http://{{resolve:ssm:/${Portfolio}/${ApplicationEnvironmentTag}/common/ApplicationLoadBalancerUrl}}/management/health"
      ArtifactS3Location:
        Fn::Join:
          - ''
          - - s3://
            - Ref: ResultsBucket
      StartCanaryAfterCreation: True
      Schedule:
        Expression: rate(1 minute) # every minute
        DurationInSeconds: 0 # run indefinitely
      SuccessRetentionPeriod: 90
      FailureRetentionPeriod: 180
Run Code Online (Sandbox Code Playgroud)

NIr*_*odi 13

终于我发现了问题

问题是关于金丝雀名称模式和验证。

该名称不得超过 21 个字符。我的比那还要大。

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-name


ago*_*dev 6

最后,我也发现了我的问题。

该名称包含大写字母。

我不想窃取答案,但也许它对其他人有帮助。我知道 21 个字符的限制,但看不到它。