AWS Cloudformation,来自自定义资源的输出值

时间:2018-07-15 19:56:15

标签: amazon-web-services amazon-cloudformation

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

1 个答案:

答案 0 :(得分:1)

因此,基本上,您可以从> library('R.utils') > library('plyr') > library('dplyr') > library('stringr') > > file.info('data/tickdata/Y2015W1.csv.gz') size isdir mode mtime data/tickdata/Y2015W1.csv.gz 11666960 FALSE 666 2018-07-14 01:12:29 ctime atime exe data/tickdata/Y2015W1.csv.gz 2018-07-14 01:11:39 2018-07-14 01:11:39 no > gzfile('data/tickdata/Y2015W1.csv.gz') A connection with description "data/tickdata/Y2015W1.csv.gz" class "gzfile" mode "rb" text "text" opened "closed" can read "yes" can write "yes" > dir('data/tickdata', patter = '.csv$') %>% str_split_fixed('Y|W|.csv', 4) %>% tbl_df %>% mutate_all(as.numeric) %>% select(V2, V3) %>% filter(V2 == 2015) # A tibble: 53 x 2 V2 V3 <dbl> <dbl> 1 2015 1 2 2015 10 3 2015 11 4 2015 12 5 2015 13 6 2015 14 7 2015 15 8 2015 16 9 2015 17 10 2015 18 # ... with 43 more rows 返回两件事

AWS::Serverless::Function

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

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

如果您对 customresourceoutput: Value: !Ref creates3bucketlambda -> name of lambda function 感兴趣,那么还有一个documentation

您可以像这样使用AWS::CloudFormation::CustomResource

Fn::GetAtt