Access AWS Athena from lambda function in a VPC

0

Hi,

I have a lambda function written in Python3.7 which will submit SQL to Athena using the boto3 library. If the lambda function is not in VPC, it works fine. But, if we attach the lambda function to a VPC, it will time out while submitting a query to Athena. We have a similar problem before with AWS system manager, which was solved by creating VPC endpoints. But VPC endpoints are not available for Athena. What should I do? Any help will be appreciated!

cli
질문됨 5년 전954회 조회
2개 답변
0

The request to the athena api needs to route over the internet. You'll need a nat instance or nat gateway in your vpc to provide that route for the lambda. https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat.html

Ellison
답변함 5년 전
0

I see. Thank you for your reply, Ellison!
If anyone runs into a similar situation, this simple tutorial shows how to create a NAT gateway: https://gist.github.com/reggi/dc5f2620b7b4f515e68e46255ac042a7
(The NAT gateway document on AWS is long and complicated for me.)

cli
답변함 5년 전
profile picture
전문가
검토됨 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠