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

AWS CloudFormation, Output value from Custom Resource

我想输出从 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

所以基本上你可以 return AWS::Serverless::Function

中的两件事
  customresourceoutput:
    Value:
      !GetAtt creates3bucketlambda.Arn -> arn of lambda function

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

有关无服务器函数输出的更多详细信息here

如果您对 AWS::CloudFormation::CustomResource 感兴趣,还有一个 documentation

您可以使用 Fn::GetAtt 如:

  customresourceoutput:
    Value:
      !GetAtt customerResource.responseKeyName -> name of the key from the response