【发布时间】:2023-02-07 04:51:14
【问题描述】:
我有一个 6Mb 的文件要上传到 S3。
目前,我使用这个配置:
无服务器.yml:
lambdaApi:
handler: public/index.php
events:
- httpApi: '*'
resources:
Conditions:
Resources:
ApiMapping:
Type: 'AWS::ApiGatewayV2::ApiMapping'
Condition: HaveCustomDomain
DependsOn: HttpApiIntegrationApi
Properties:
ApiMappingKey: "my-project"
DomainName: my.domain.co
ApiId: !Ref HttpApi
Stage: "$default"
问题是因为我的lambdaApiLambda,我的POST请求不能超过6MB。
我试过使用这个解决方案(来自这里:https://theburningmonk.com/2020/04/hit-the-6mb-lambda-payload-limit-heres-what-you-can-do/):
但它不适用于AWS ApiGatewayV2。
当我使用这个自定义无服务器尝试插件 https://github.com/serverless-operations/serverless-apigateway-service-proxy 时:
apiGatewayServiceProxies:
- s3:
path: /my/path
method: post
action: PutObject
bucket: dev-connect-files
cors: true
requestParameters:
# if requestParameters has a 'integration.request.path.object' property you should remove the key setting
'integration.request.path.object': 'context.requestId'
'integration.request.header.cache-control': "'public, max-age=31536000, immutable'"
我可以创建一个 POST 路由,但它与我的真实 API 是分离的。
我无法访问 /my/path 应该执行的 PHP 代码。
我知道我可以选择使用预签名 URL,但我暂时不想使用它。
问题:
- 是否可以使用这个插件
https://github.com/serverless-operations/serverless-apigateway-service-proxy
与
AWS ApiGatewayV2
【问题讨论】:
标签: amazon-web-services amazon-s3 aws-lambda aws-api-gateway