Whenever you configure a S3 bucket which will send messages to an AWS Lambda function during this a resource policy rule will a be created that will grants access to the Lmabda function to use the S3 bucket. This way you can configure a S3 bucket to use the Lambda function.
Hope this helps.