AWS SAM CLI: How to code Lambda with EventBridge trigger?

56 Views Asked by At

Following the Combined Template description of this documentation, I built this Lambda function in my template.yaml file as follows, believing that it would automatically create an EventBridge rule out of the material here. In fact, no such rule was created, I deployed and there is no rule named OnBatchJobStateChange or anything of the sort. What am I missing?

  BlastDbUpdaterFunction:
    _comment: "runs as needed to keep our data base updated to the state of batch jobs"
    Type: AWS::Serverless::Function
    Properties:
      PackageType: Image
      Architectures:
      - x86_64
      CodeUri: /
      ImageConfig:
        Command:
        - blast-db-updater.lambda_handler
      ImageUri:   BlastJobsStatusFunction:latest
    Events:
      Trigger:
        Type: EventBridgeRule 
        Properties:
          RuleName: OnBatchJobStateChange
          Pattern:
            source:
              - aws.batch
            detail-type:
              - Batch Job State Change                
    Metadata:
      Dockerfile: Dockerfile
      DockerContext: .
      DockerTag: python3.11-v1

BTW, a rule type of CloudWatchRule doesn't work either.

0

There are 0 best solutions below