amazon-s3 - Adding S3 trigger to Lambda function using CloudFormation
问题描述
I'm trying to add an S3 trigger to a lambda function using CloudFormation. From what I've read about circular references the lambda function and S3 bucket needs to be created first, which I've done with a template and they get created successfully.
Then I go into "Update Stack" and enter the template:
"Resources": {
"MyBucket": {
"Type": "AWS::S3::Bucket",
"NotificationConfiguration": {
"LambdaConfigurations": [
{
"Event": "s3:ObjectCreated:*",
"Function": "arn:aws:lambda:ap-southeast-2:newlyCreatedLambda"
}
]
},
"Properties": {
"BucketName": "MyBucket"
....
....
But when I try to deploy it gives the error:
Template is not valid: Invalid template resource property 'NotificationConfiguration'
Any idea how to get the trigger added or what I'm doing wrong?
解决方案
这是我们使用的:
"BucketForFunctionsAcesImportNewFileUploaded": {
"Type": "AWS::S3::Bucket",
"Properties": {
"NotificationConfiguration": {
"TopicConfigurations": [],
"QueueConfigurations": [],
"LambdaConfigurations": [
{
"Function": {
"Fn::GetAtt": [
"FunctionsAcesImportNewFileUploaded",
"Arn"
]
},
"Event": "s3:ObjectCreated:*"
}
]
},
"VersioningConfiguration": {
"Status": "Suspended"
}
},
"DeletionPolicy": "Delete"
}
推荐阅读
- paraview - 在 Paraview 中计算张量的转置
- python - 使用 jinja(烧瓶)在 2 个单独的列中使用 2 个循环数据?
- ios - 旁白:UIAccessibilityLayoutChangedNotification 不起作用
- python-3.x - 跨两个列表框移动项目时,Python tkinter 保持名称顺序一致
- typescript - typescript 动态导入与 tsconfig.json 中的 webpack.config 冲突?
- python - 从包含python中字典的嵌套列表创建字典
- python-3.x - 单个轮廓的边界框,一种颜色除外
- reactjs - 无法正确地将值从父母传递给孩子和孩子传递给父母
- julia - 如何使用DifferentialEquations.jl消除具有不确定形式的微分方程的解中的振荡
- caching - 在 Apache Ignite 中获取数据区域的 maxSize