AWS API(s3api)不支持CloudFormation功能吗?

时间:2018-07-13 09:29:41

标签: amazon-web-services aws-lambda

以下是aws s3api put-bucket-notification-configuration --bucket bucket-name --notification-configuration file://s3_lambda.json

的json
# s3_lambda.json
{
    "LambdaFunctionConfigurations": [
      {
        "LambdaFunctionArn": {"Fn::ImportValue": "RekogModerationLambdaFunction"},
        "Events": [
          "s3:ObjectCreated:*"
        ],
        "Filter": {
          "Key": {
            "FilterRules": [
              {
                "Name": "prefix",
                "Value": "upload/"
              }
            ]
          }
        }
      }
    ]
}

aws> cloudformation list-exports

{
    "Exports": [
        {
            "ExportingStackId": "arn:aws:cloudformation:ap-northeast-2:300378067049:stack/spooncast-lambda-rekog-sam-sm-test/d8452dd0-8678-11e8-9ab8-50fae7d43856",
            "Name": "RekogModerationLambdaFunction",
            "Value": "arn:aws:lambda:ap-northeast-2:300378067049:function:spooncast-lambda-rekog-sam-sm-test-moderation"
        }
    ]
}

看看我在json中使用Fn::ImportValue的原因。

实际上,我希望CloudFomration函数起作用,并将适当的值放在LambdaFunctionArn中。

但是,看起来没有,返回错误。 (如果我将Arn字符串直接不起作用,则可以正常工作)

Parameter validation failed:
Invalid type for parameter NotificationConfiguration.LambdaFunctionConfigurations[0].LambdaFunctionArn, value: OrderedDict([('Fn::ImportValue', 'RekogModerationLambdaFunction')]), type: <class 'collections.OrderedDict'>, valid types: <class 'str'>

AWS api不支持CloudFormation函数是正确的。

可以,但是我用错了吗?

0 个答案:

没有答案