简体   繁体   中英

Unable to create scheduled event using AWS SAM

I have a SAM template.yaml like below:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'

Resources:
  GathererFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: main.handler
      Runtime: nodejs14.x
      Events:
        GathererDataSchedule:
          Type: Schedule
          Properties:
            Schedule: 'rate(1 minute)'
  GathererBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: gatherer-bucket

I run sam validate and it comes back fine.

I try to run sam deploy and the deployment fails when creating the schedule. Error says: ScheduleExpression is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; error code: ValidationException; ScheduleExpression is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; error code: ValidationException;

I've also tried Schedule: rate('1 minute') and Schedule: rate(1 minute)

Where am I going wrong?

For me this template is deploying fine using the SAM cli.

在此处输入图像描述

May you try to update your SAM cli? And also check if you have permissions to create Eventbridge events?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM