https://pulumi.com logo
Title
r

rhythmic-actor-14991

06/02/2021, 3:53 AM
hi , how can i add the cronjob tigger for lambda by typescript?
b

billowy-army-68599

06/02/2021, 3:54 AM
could yoi share a little more about what's not working?
r

rhythmic-actor-14991

06/02/2021, 3:57 AM
const machineRobotFunc = new aws.lambda.Function("machineRobotFunc", {
   code: new pulumi.asset.AssetArchive({
     ".": new pulumi.asset.FileArchive("./robot/machine_reporter"),
   }),
    runtime: "python3.8",
   handler: "machine_reporter.handler",
    role: machineRobotRole.arn,
    environment: {
      variables: {
        "feishu_webhook": machineRobotWebookUrl
      }
    },
  }, {dependsOn: [machineRobotRole, machineRobotRolePolicy] });

 const eventRule = new aws.cloudwatch.EventRule(`machineRobotFunc-rule`,
  { scheduleExpression: "rate(5 minutes)" },
);

 const machineRobotEventTarget = new aws.cloudwatch.EventTarget("machineRobotEventTarget", {
    arn: machineRobotFunc.arn,
    rule: eventRule.id,
    },
  );
I coding like this, but the lambda didn't run ..
how can I add the cron eventbridge for the lambda?