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
gefragt vor 5 Jahren955 Aufrufe
2 Antworten
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
beantwortet vor 5 Jahren
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
beantwortet vor 5 Jahren
profile picture
EXPERTE
überprüft vor 6 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen