I am running boto3 on AWS Lambda but getting a boto3 client is very slow. I am currently running a python3.9 runtime on AWS Lambda that creates handfuls of presigned url for s3 resources.
A key line of code required to generate the url with boto3 is
print("Getting boto3")
self.s3_client = boto3.client('s3')
print("Got client s3")
shockingly, the above single line of code takes a full 2000ms to execute according to the logs in cloudwatch:
2023-04-18T13:34:18.891-04:00 Getting boto3
2023-04-18T13:34:20.733-04:00 Got client s3
Is this normal and can I make it go faster? I saw an old post indicating that client acquisition speed might be improved by explicitly passing credentials or increasing memory size. It seems strange that the basic s3 interface cannot be acquired in less than 2s.