阅读(2774) (0)

Micronaut AWS Lambda

2023-02-23 13:43:12 更新

对 AWS Lambda 的支持在 Micronaut AWS 子项目中实现。

使用 AWS Lambda 的简单函数

您可以使用直接实现 AWS Lambda SDK API 的 Micronaut 实现 AWS 请求处理程序。

使用 CLI

要创建 AWS Lambda 函数:

$ mn create-function-app my-app --features aws-lambda

或者使用 Micronaut Launch

$ curl https://launch.micronaut.io/create/function/example\?features\=aws-lambda -o example.zip
$ unzip example.zip -d example

AWS Lambda 的 HTTP 函数

您可以使用 Micronaut 对 AWS API Gateway 的支持来部署使用 @Controller 等的常规 Micronaut 应用程序。

使用 CLI

创建 AWS API Gateway 代理应用程序:

$ mn create-app my-app --features aws-lambda

或者使用 Micronaut Launch

$ curl https://launch.micronaut.io/example.zip\?features\=aws-lambda -o example.zip
$ unzip example.zip -d example