AWS Cloudformation,来自自定义资源的输出值 [英] AWS Cloudformation, Output value from Custom Resource

查看:186
本文介绍了AWS Cloudformation,来自自定义资源的输出值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想输出从Cloudformation自定义资源获得的值。我肯定会返回值,但是我不确定如何在输出中引用它。

I wanted to output a value I get form an Cloudformation Custom Resource. I'm definitely returning the value, but I wasn't sure how to reference it in an Output

这是我的template.yml:

This is my 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,

I'm not sure if I use a !Sub, !Ref,

推荐答案

所以基本上可以返回 AWS :: Serverless :: Function

  customresourceoutput:
    Value:
      !GetAtt creates3bucketlambda.Arn -> arn of lambda function

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

有关无服务器功能输出的更多详细信息此处

More details about serverless function outputs here.

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

If you're interested in AWS::CloudFormation::CustomResource there is also a documentation for that.

您可以使用 Fn :: GetAtt 如:

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

这篇关于AWS Cloudformation,来自自定义资源的输出值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆