AWS CloudFormation,自定义资源的输出值

3

我想输出一个从CloudFormation自定义资源中获取的值。我肯定已经返回了这个值,但是我不确定如何在输出中引用它。

这是我的template.yml

Outputs:
  customresourceoutput:
    Value:
      !GetAtt creates3bucketlambda.myvalue

Resources:
  creates3bucketlambda:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: nodejs6.10
      CodeUri: setups3bucket
      MemorySize: 512
      Timeout: 300
      Policies:
        - AWSLambdaBasicExecutionRole
        - AmazonS3FullAccess

  Creates3BucketLoginPage:
    Type: Custom::AppConfiguration
    Properties:
      ServiceToken: !GetAtt creates3bucketlambda.Arn
      aOrg:
        !Ref aOrg

我收到的错误信息是:
Failed to create the changeset: Waiter 
ChangeSetCreateComplete failed: Waiter encountered a terminal failure 
state Status: FAILED. Reason: Template error: resource 
creates3bucketlambda does not support attribute type myvalue in 
Fn::GetAtt

我不确定是否要使用!Sub!Ref


那不是自定义资源,那是一个SAM函数。"使用AWS::CloudFormation::CustomResourceCustom::*String*资源类型在您的模板中定义自定义资源。" - undefined
是的,我不小心忘记了自定义资源。对此我感到抱歉。 - undefined
1个回答

2
基本上你可以从 AWS::Serverless::Function 返回两个东西。
  customresourceoutput:
    Value:
      !GetAtt creates3bucketlambda.Arn -> arn of lambda function

and

  customresourceoutput:
    Value:
      !Ref creates3bucketlambda -> name of lambda function

更多关于无服务器函数输出的详细信息请查看此处
如果您对AWS::CloudFormation::CustomResource感兴趣,也可以参考此文档
您可以使用Fn::GetAtt,例如:
  customresourceoutput:
    Value:
      !GetAtt customerResource.responseKeyName -> name of the key from the response

好的,我弄清楚了,我需要引用自定义资源,这样就能返回我想要的值... 值: !GetAtt Creates3BucketLoginPage.key - undefined
嗨,我在哪里可以找到lambda支持的自定义资源的响应键? - undefined
嗨 @ColossusMark1 在日志中。你是如何在哪里运行你的云形成? - undefined
在 CloudFormation 向导上运行时,我找到了响应键,它位于 Lambda 响应中 :D 再次感谢! - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接