无服务器部署不会创建 API 网关

Serverless deploy does not create API gateway

这是我的 serverless.yml 文件:

service: investor-bot


provider:
  name: aws
  runtime: python3.9
  stage: dev


functions:
  post:
    handler: handler.hello
    events:
      - http:
          path: ita-investor-bot
          method: get

这是代码(即使使用此代码也不起作用):

def hello(event, context):
    return {"statusCode": 200}

我导出了我的 AWS 凭证和 运行 无服务器部署:

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service investor-bot.zip file to S3 (12.77 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.......................................
Serverless: Stack update finished...
Service Information
service: investor-bot
stage: dev
region: us-east-1
stack: investor-bot-dev
resources: 11
api keys:
  None
endpoints:
  GET - https://933zcto8tc.execute-api.us-east-1.amazonaws.com/dev/ita-investor-bot
functions:
  post: investor-bot-dev-post
layers:
  None
Serverless: Removing old service artifacts from S3...
Serverless: Deprecation warning: Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release.
            Switch to it now by setting "provider.lambdaHashingVersion" to "20201221"
            More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2

Toggle on monitoring with the Serverless Dashboard: run "serverless"

我在 API 网关中的 AWS 帐户中看不到任何内容。我无法访问端点:

肯定有一个已部署的 API 网关。您已经在 us-east-1 中部署了您的堆栈,我的最佳猜测是您正在另一个区域使用 AWS 控制台。

登录 AWS 控制台后,使用右上角的区域切换器切换到 us-east-1,从那里您应该可以看到 API 网关、lambda 函数和 cloudwatch 日志.