我正在为s3存储桶添加主题配置,并得到以下异常:
无法验证以下目标配置(服务:Amazon S3;状态代码:400;错误代码:InvalidArgument
我已经向s3授予了lambda权限,但仍然遇到异常。请找到以下代码。
"Resources": {
"s3Mock":{
"DependsOn": "LambdaInvokePermission",
"Type": "AWS::S3::Bucket",
"Properties": {
"NotificationConfiguration": {
"LambdaConfigurations": [{
"Event": "s3:ObjectCreated:Put",
"Filter": {
"S3Key": {
"Rules": [
{
"Value": ".zip",
"Name": "suffix"
}
]
}
},
"Function": {
"Fn::GetAtt": [
"LambdaMock",
"Arn"
]
}
}
]
}
}
},
"LambdaMock": {
"DependsOn": "IAMPolicy",
"Type": "AWS::Lambda::Function",
"Properties": {
"FunctionName": {
"Ref": "Lambda"
},
"Description": "A Lambda function which will persist the data into RDS",
"Code": {
"S3Bucket" :{"Fn::ImportValue" : {"Fn::Sub" : "${s3StackParameter}-BucketName"}},
"S3Key" :"abc/adi-cpm-analytics-mock-lambda.zip"
},
"Handler": "adi-cpm-analytics-mock-lambda.lambda_handler",
"Role": {
"Fn::GetAtt": [
"IAMRole",
"Arn"
]
},
"Runtime": "python3.7",
"Timeout": 300
}
},
"LambdaInvokePermission": {
"DependsOn": "LambdaMock",
"Type": "AWS::Lambda::Permission",
"Properties": {
"FunctionName": {
"Fn::GetAtt": [
"LambdaMock",
"Arn"
]
},
"Action": "lambda:InvokeFunction",
"Principal": "s3.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {"Fn::ImportValue" : {"Fn::Sub" : "${s3StackParameter}-BucketArn"}}
}
},
请让我知道解决该问题的代码中缺少的内容。
答案 0 :(得分:0)
这里有几个问题:
int num;
参数未定义。s3StackParameter
和Lambda
资源。有关创建S3存储桶以向Lambda发送通知的正确示例,请参见此帖子:https://aws.amazon.com/premiumsupport/knowledge-center/unable-validate-circular-dependency-cloudformation/