如何在 aws lambda 前面设置内部自定义域?
How to set up internal custom domain in front of aws lambda?
我有这样的情况,我需要我在 AWS 中的 lambda 到自定义内部域上的 运行?我真的不知道从哪里开始。我有一个虚拟私有云 (VPC) 设置和我的 lambda 运行s 在里面,我也在 Route53 中有内部 URL 设置,但我不知道如何将两者粘合在一起。当有人调用这个内部 URL 时,我想调用我的 lambda。关于我应该做什么的任何建议。
为了创建内部 API,您可以在 aws API 网关中部署 API。您还需要将 endpointType 显式设置为私有。
步骤:
部署您的api(私有)
默认情况下所有 api 网关 api 都是 public。您应该通过将 endpointType
属性设置为 private
来明确地将 api 部署为私有。
您还需要为 API 创建资源策略以创建私有 api.
为 API 网关创建私有 VPC 端点
您需要创建私有 VPC 端点,因为您只能通过私有 VPC 端点访问私有 API。
记住: 如果您执行此步骤,您的所有其他 public API 只能通过其自定义域访问。
将 VPC 端点附加到您的私有 API
您需要将 vpc 端点附加到您的 api
正在访问私有 api
您只能通过私有 vpc 端点通过私有 api 访问。
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
参考:https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-private-endpoints/
private vpc endpoint
的自定义 DNS 名称
您可以通过创建别名记录从 Route53
创建自定义域名以指向 private vpc endpoint
url。
参考:https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-vpc-interface-endpoint.html
我有这样的情况,我需要我在 AWS 中的 lambda 到自定义内部域上的 运行?我真的不知道从哪里开始。我有一个虚拟私有云 (VPC) 设置和我的 lambda 运行s 在里面,我也在 Route53 中有内部 URL 设置,但我不知道如何将两者粘合在一起。当有人调用这个内部 URL 时,我想调用我的 lambda。关于我应该做什么的任何建议。
为了创建内部 API,您可以在 aws API 网关中部署 API。您还需要将 endpointType 显式设置为私有。
步骤:
部署您的api(私有)
默认情况下所有 api 网关 api 都是 public。您应该通过将 endpointType
属性设置为 private
来明确地将 api 部署为私有。
您还需要为 API 创建资源策略以创建私有 api.
为 API 网关创建私有 VPC 端点
您需要创建私有 VPC 端点,因为您只能通过私有 VPC 端点访问私有 API。
记住: 如果您执行此步骤,您的所有其他 public API 只能通过其自定义域访问。
将 VPC 端点附加到您的私有 API
您需要将 vpc 端点附加到您的 api
正在访问私有 api
您只能通过私有 vpc 端点通过私有 api 访问。
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
参考:https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-private-endpoints/
private vpc endpoint
的自定义 DNS 名称
您可以通过创建别名记录从 Route53
创建自定义域名以指向 private vpc endpoint
url。
参考:https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-vpc-interface-endpoint.html