我们正在使用CloudFormation模板创建一个S3存储桶.每当将文件添加到S3存储桶时,我想关联(将事件添加到S3存储桶)Lambda函数.
如何通过CloudFormation模板实现.CloudFormation中需要使用哪些属性.
我想使用以下 cloudformation 模板在单个现有 S3 存储桶上创建多个事件通知。但是,即使我在 BucketConfiguration 资源下指定了另一个“LambdaFunctionConfigurations”,我也只能看到在 S3 存储桶上创建的一个事件。我还尝试使用单独的事件配置创建另一个 BucketConfiguration 资源,但没有任何运气。我正在寻找任何可以帮助我指明正确方向的提示或建议。从我收集到的 s3.putBucketNotification 方法将清除任何现有的事件通知配置。请记住,CF 模板确实创建了单个事件通知(我希望创建多个事件通知)。
以下模板的模型: 使用 CloudFormation 在 S3 存储桶中创建 Lambda 通知
Description: >-
Create an event notification for an existing S3 bucket
Parameters:
BucketName:
Description: S3 Bucket name (must already exist)
Type: String
Resources:
BucketConfiguration:
Type: 'Custom::S3BucketConfiguration'
DependsOn:
- BucketPermission
- NotificationBucketPolicy
Properties:
ServiceToken: !GetAtt S3BucketConfiguration.Arn
Bucket: !Ref BucketName
NotificationConfiguration:
LambdaFunctionConfigurations:
- Events:
- 's3:ObjectCreated:*'
LambdaFunctionArn: MyLambdaArn
Metadata:
'AWS::CloudFormation::Designer':
id: 606b322f-42fa-4d20-bae4-53374d7ad7ba
S3BucketConfiguration:
Type: 'AWS::Lambda::Function'
Properties:
Description: S3 Object Custom …Run Code Online (Sandbox Code Playgroud)