From the accepted Stack Overflow answer: There is no error message it just times out. Unfortunately, a lambda function in a VPC does not have internet access nor public IP . From docs : Connecting a function to a public subnet does not give it internet access or a public IP address . Therefore, when you use boto3 : client = session.client( service_name='secretsmanager', region_name=region_name ) to connect to the Secrets Manager it times out, because boto3 can't connect to the Secrets Manager manager from the VPC. There are two ways to rectify this : Place your function in a private subnet and use NAT gateway/instance with correctly configured route tables to provide the internet access, and consequently, to the Secrets Manager . Setup VPC interface endpoint for Secrets Manager in a private subnet. This way your lambda function will be able to connect to the Secrets Manager using the endpoint, without needing the internet.

Context: Problem: Accepted solution (score 34): There is no error message it just times out. Unfortunately, a lambda function in a VPC does not have internet access nor public IP . From docs : Connecting a function to a public subnet does not give it internet access or a public IP address . Therefore, when you use boto3 : client = session.client( service_name='secretsmanager', region_name=region_name ) to connect to the Secrets Manager it times out, because boto3 can't connect to the Secrets Manager manager from the VPC. There are two ways to rectify this : Place your function in a private subnet and use NAT gateway/instance with correctly configured route tables to provide the internet access, and consequently, to the Secrets Manager . Setup VPC interface endpoint for Secrets Manager in a private subnet. This way your lambda function will be able to connect to the Secrets Manager using the endpoint, without needing the internet.

## Matched source
Source: Stack Overflow question: https://stackoverflow.com/questions/62274069/aws-lambda-access-secrets-manager-from-within-vpc
Original query: "AWS Lambda access Secrets Manager from within VPC (AWS Secrets Manager)"
Key terms: access, lambda, manager, secrets, within
