You cannot set host in config file, however you can override it from your code with boto3.
import boto3
session = boto3.session.Session()
s3_client = session.client(
service_name='s3',
aws_access_key_id='aaa',
aws_secret_access_key='bbb',
endpoint_url='http://localhost',
)
Then you can interact as usual.
print(s3_client.list_buckets())
This is most likely a configuration error in your VPC endpoint policies. If your policies are correct, then Boto3 never knows exactly how it's able to reach the S3 location, it really is up to the policies to allow/forbid this type of traffic.
Here's a quick walkthrough of what you can do for troubleshooting: https://aws.amazon.com/premiumsupport/knowledge-center/connect-s3-vpc-endpoint/
Other relevant docs: