Solution 1:

If your function has nothing to do with S3 then don't use this managed policy. As far as I can see this policy is used in the documentation in combination with a tutorial on how to use Lambda with Amazon S3.

Source: https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-create-iam-role.html

If you want to use a managed policy I recommend using AWSLambdaBasicExecutionRole which appear to contains only the minimum:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": "*"
    }
  ]
}