Lambda 触发一个函数本身
Lambda trigger a function itself
您好,我有一个具有 serverless
架构的 laravel
应用程序。我收到一个错误:
cURL error 28: Failed to connect to fnhxdorrd22l.execute-api.ap-southeast-1.amazonaws.com port 443 after 7502 ms: Connection timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://fnhxdorrdl22.execute-api.ap-southeast-1.amazonaws.com/oauth/token
是否需要配置此规则或任何入站规则才能在函数内部调用函数?顺便说一句,如果它是一个简单的调用或请求而没有任何调用或触发其他路由或第三方,它就可以工作。
Serverless.yml
service: laravel
provider:
name: aws
# The AWS region in which to deploy (us-east-1 is the default)
region: ap-southeast-1
# The stage of the application, e.g. dev, production, staging… ('dev' is the default)
stage: dev
profile: serverless
runtime: provided.al2
lambdaHashingVersion: 20201222321
package:
# Directories to exclude from deployment
patterns:
- '!node_modules/**'
- '!public/storage'
- '!resources/assets/**'
- '!storage/**'
- '!tests/**'
- 'storage/oauth-private.key'
- 'storage/oauth-public.key'
functions:
# This function runs the Laravel website/API
web:
handler: public/index.php
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
vpc:
securityGroupIds:
- sg-042d6942052649ad59b0bc0
subnetIds:
- subnet-2c1464319824244
- subnet-474851e914424e4
- subnet-4424429f48129d7
layers:
- ${bref:layer.php-80-fpm}
events:
- httpApi: '*'
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
timeout: 120 # in seconds
layers:
- ${bref:layer.php-80} # PHP
- ${bref:layer.console} # The "console" layer
在 VPC 中配置为 运行 的 Lambda 函数永远不会获得 public IP 地址(无论 VPC public IP 设置如何)。 API 网关 URL 是互联网上的 public URL。 API 网关 URL 在 VPC 中不存在。为了让 Lambda 函数与那个 URL 建立连接,该函数必须在具有到 NAT 网关的路由的私有 VPC 子网中配置为 运行。
您好,我有一个具有 serverless
架构的 laravel
应用程序。我收到一个错误:
cURL error 28: Failed to connect to fnhxdorrd22l.execute-api.ap-southeast-1.amazonaws.com port 443 after 7502 ms: Connection timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://fnhxdorrdl22.execute-api.ap-southeast-1.amazonaws.com/oauth/token
是否需要配置此规则或任何入站规则才能在函数内部调用函数?顺便说一句,如果它是一个简单的调用或请求而没有任何调用或触发其他路由或第三方,它就可以工作。
Serverless.yml
service: laravel
provider:
name: aws
# The AWS region in which to deploy (us-east-1 is the default)
region: ap-southeast-1
# The stage of the application, e.g. dev, production, staging… ('dev' is the default)
stage: dev
profile: serverless
runtime: provided.al2
lambdaHashingVersion: 20201222321
package:
# Directories to exclude from deployment
patterns:
- '!node_modules/**'
- '!public/storage'
- '!resources/assets/**'
- '!storage/**'
- '!tests/**'
- 'storage/oauth-private.key'
- 'storage/oauth-public.key'
functions:
# This function runs the Laravel website/API
web:
handler: public/index.php
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
vpc:
securityGroupIds:
- sg-042d6942052649ad59b0bc0
subnetIds:
- subnet-2c1464319824244
- subnet-474851e914424e4
- subnet-4424429f48129d7
layers:
- ${bref:layer.php-80-fpm}
events:
- httpApi: '*'
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
timeout: 120 # in seconds
layers:
- ${bref:layer.php-80} # PHP
- ${bref:layer.console} # The "console" layer
在 VPC 中配置为 运行 的 Lambda 函数永远不会获得 public IP 地址(无论 VPC public IP 设置如何)。 API 网关 URL 是互联网上的 public URL。 API 网关 URL 在 VPC 中不存在。为了让 Lambda 函数与那个 URL 建立连接,该函数必须在具有到 NAT 网关的路由的私有 VPC 子网中配置为 运行。