Search code examples
aws-lambdaboto3aws-event-bridge

Python Lambda boto3 Unknown service: 'scheduler' error


I'm trying to create a EventBridgeScheduler client in my Python 3.9.15 Lambda, but the service responds with UnknownServiceError: Unknown service: 'scheduler'. Isn't this service supported even though it's included in boto3's official documentation? The list included in the error message doesn't include scheduler among Valid service names.

import boto3

eb_client = boto3.client('scheduler')


def lambda_handler(event, context):
    print(json.dumps(event))

    schedule_name = event['resources']
    delete_schedule(schedule_name)


def delete_schedule(name):
    try:
        response = eb_client.delete_schedule(
            Name=name
        )
    except Exception as e:
        print(str(e))

Solution

  • The scheduler feature was added to boto3 in v1.26.7. The Lambda Python runtimes currently come with v1.20.32.

    Package up the latest SDK version with your Lambda to use the EventBridge scheduler client.