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
demandé il y a 5 ans954 vues
2 réponses
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
répondu il y a 5 ans
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
répondu il y a 5 ans
profile picture
EXPERT
vérifié il y a 6 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions