lambda에서 public subnet 세팅시에 curl이 안되는 이유?

0

lambda에서 vpc를 세팅해서 쓰고 있던 중에 curl이 안되는 이슈를 발견했습니다.

당시에 subnet을 public subnet으로 설정을 해서 쓰고 있었는데 private subnet으로 바꿔서 해결했습니다.

혹시 어떤 이유로 public에선 안되고 private에서는 curl이 되었던걸까요?

보안그룹은 동일한 보안그룹을 쓰고 있었습니다.

Seobs
asked 5 months ago208 views
1 Answer
0
Accepted Answer

안녕하세요.

Lambda를 VPC에 연결할 때 퍼블릭 서브넷을 사용해도 Lambda의 ENI에는 퍼블릭 IP가 설정되지 않아 연결할 수 없었다고 생각됩니다.
https://docs.aws.amazon.com/ko_kr/lambda/latest/dg/configuration-vpc.html#vpc-configuring

프라이빗 리소스에 연결하려면 함수를 프라이빗 서브넷에 액세스합니다. 함수에 인터넷 액세스 권한이 필요한 경우 NAT(Network Address Translation)를 사용합니다. 함수를 퍼블릭 서브넷에 연결해도 인터넷 액세스 권한 또는 퍼블릭 IP 주소는 제공되지 않습니다.

프라이빗 서브넷으로 변경하여 이동한 이유로 생각되는 것은 NAT Gateway를 경유하고 있기 때문이라고 생각됩니다.

profile picture
EXPERT
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions