How to refer a derived variable in Cloudformation

前端 未结 1 1934
眼角桃花
眼角桃花 2021-02-20 02:38

I am looking for small help in cloudformation and could not find help from documentation or may be not searching the question in right way.

Here is the question.

1条回答
  •  太阳男子
    2021-02-20 03:10

    Unfortunately, the short answer is you can't. Hopefully someday AWS supports variables in CloudFormation.

    There are some hacks that might be of interest. Emphasis on hack!

    • Use a CloudFormation pre-processor that does what you want (eg, Troposphere)
    • Use a Custom Resource that outputs the value, then use GetAtt to refer to the value. (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html)
    • Use the AWS::Include transform to refer to a template snippet in S3 (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html), in that case you're not really using variables, off course.

    0 讨论(0)
提交回复
热议问题