- Newest
- Most votes
- Most comments
In short: The blog post you reference is the way to go forward.
But in a little more detail: There are two components here (at a networking level).
First, there is the connection to API Gateway from the API caller. When called that invokes the Lambda function and the Lambda function can return data to the caller. That traffic is between the caller IP address and the API Gateway IP address.
Second, there is the connection that the Lambda function establishes (outbound) to the third-party API. By default, Lambda functions can connect to external (Internet-hosted) services with no other configuration but as you've pointed out there is no static IP there. To have Lambda appear to come from a static IP address you need to have it connected to a VPC and use NAT Gateway as per the blog post.
Relevant content
- asked 2 years ago
- Accepted Answerasked 6 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 3 years ago
But Unfortunately after the implementation of said blog and https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/generate-a-static-outbound-ip-address-using-a-lambda-function-amazon-vpc-and-a-serverless-architecture.html there is no success in getting static public IP for lambda. I am checking remote IP in chrome -> Network tab and in Postman. They are different on every invocation response. What I might be missing?
A Lambda function will not get a static public IP. The public IP will belong to the NAT Gateway.