【发布时间】:2021-12-31 16:26:56
【问题描述】:
我想创建一个 Lambda 函数,该函数从在同一 CloudFormation 堆栈中创建的 S3 存储桶触发,但无法完全正确地获取语法。
只有在对象上传到/uploads 时才会触发该事件。我还需要指定一些存储桶属性 (CORS)。
资源中的 S3 存储桶定义
resources:
Resources:
myBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-bucket
# CORS properties...
函数定义中的事件:
events:
- s3:
bucket: myBucket
event: s3:ObjectCreated:Put
rules:
- prefix: uploads/
我不想使用existing: true,因为它为这个简单的任务创建了一些帮助对象。我找不到任何适合我情况的文档或示例。
【问题讨论】:
标签: amazon-web-services amazon-s3 aws-lambda amazon-cloudformation serverless-framework