簡體   English   中英

Lambda 觸發 function 本身

[英]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

為了在 function 中調用 function,是否需要配置此規則或任何入站規則? 順便說一句,如果它是一個簡單的調用或請求而沒有任何調用或觸發其他路由或第三方,它就可以工作。

無服務器.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 function 永遠不會獲得公共 IP 地址(無論 VPC 公共 IP 設置如何)。 API 網關 URL 是 Inte.net 上的公共 URL。 VPC 中不存在 API 網關 URL。 為了使 Lambda function 與 URL 建立連接,必須將 function 配置為在具有到 NAT 網關的路由的私有 VPC su.net 中運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM