Reputation: 1954
I have situation where i need my lambda in AWS to run on custom internal domain? I really don't know where to start. I have A virtual private cloud (VPC) setup and my lambda runs inside, also i have internal URL setup in Route53, but I don't know how to glue the two together. I want to invoke my lambda when someone call this internal URL. any suggestions on what i should do.
Upvotes: 1
Views: 926
Reputation: 8593
In order to create an internal API, You can deploy the API in the aws API Gateway. you will also need to explicitly set the endpointType to private.
Steps:
by default all the api gateway apis are public. you should explicitly deploy your api as private by setting the endpointType
attribute to private
.
you will also need to create a resource policy for the API to create a private api.
You need to create a private VPC endpoint because you can only access the private API through the private vpc endpoint.
remember: if you do this step, all of your other public APIs accessible only though their custom domains.
you need to attach the vpc endpoint to your api
you can only access through the private api through the private vpc endpoint.
curl https://vpce-07f635e4b63555555-abcwdo3f.execute-api.ap-southeast-2.vpce.amazonaws.com/development/hello -H 'x-apigw-api-id: abcdefg2k8'
#VPC Endpoint DNS URL: https://vpce-07f635e4b63555555-abcwdo3f.execute-api.ap-southeast-2.vpce.amazonaws.com
#API Stage: /development
#Endpoint path: /hello
# Your rest api Identifier: abcdefg2k8
Reference: https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-private-endpoints/
private vpc endpoint
you can create a custom domain name from Route53
to point to the private vpc endpoint
url by creating an Alias record.
Reference: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-vpc-interface-endpoint.html
Upvotes: 1