Immutable solution version
AWS Lambda access Secrets Manager from within VPC (AWS Secrets Manager)
Complete solution
AWS Lambda access Secrets Manager from within VPC (AWS Secrets Manager): From the accepted Stack Overflow answer: There is no error message it just times out.
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( servicename='secretsmanager', regionname=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( servicename='secretsmanager', regionname=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
Evidence
Source: 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( servicename='secretsmanager', regionname=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.
Verified resolution: 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( servicename='secretsmanager', regionname=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.
Source URL: https://stackoverflow.com/questions/62274069/aws-lambda-access-secrets-manager-from-within-vpc
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_bS1dLgRxuBYfIISwtkwQTw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">AWS Lambda access Secrets Manager from within VPC (AWS Secrets Manager) <span>— Vectle</span></a>