首先,确认您已经使用了正确的语法来设置 Lambda 的调度计划,并且确保您的计划符合以下格式:'cron(0/5 * * * ? *)”。
如果确认计划格式和语法都没有问题,那么您需要检查 Lambda 的运行日志,以便确定是否出现了任何错误。您可以通过以下代码来查看日志:
import boto3
client = boto3.client('logs')
response = client.get_log_events( logGroupName='/aws/lambda/your_lambda_function_name', limit=10, startFromHead=True, )
print(response)
import boto3
client = boto3.client('lambda')
response = client.update_function_configuration( FunctionName='your_lambda_function_name', State='Active' )
print(response)
import boto3
client = boto3.client('events')
response = client.put_rule( Name='your_rule_name', ScheduleExpression='cron(0 0 * * ? *)', State='ENABLED' )
print(response)