The AWS::Lambda::Function resource can't set an event handler on the function itself. Maybe a [Lambda Custom Resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-custom-resources-lambda-lookup-amiids.html) would be able to do it.