如何在对流层中写入伪参数?

时间:2016-06-01 13:59:19

标签: python amazon-web-services troposphere

我想将伪参数用于TopicConfigurations主题。这样我就可以选择一个arn。如何使用对流层编写伪参数?

主题配置:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-topicconfig.html

Psuedo参数:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html

3 个答案:

答案 0 :(得分:0)

我认为应该是它,来自对流层/ init .py:

Ref(AWS_NOTIFICATION_ARNS))

答案 1 :(得分:0)

您只需在Ref()调用中使用参数的名称,如下所示:

Ref("AWS::NotificationARNs")

我一直都在使用它,主要使用" AWS :: NoValue"或者" AWS :: Region"在我的大多数用例中。

祝你好运!

答案 2 :(得分:0)

使用Fn :: Join,AWS :: Region和AWS :: AccountId组成ARN的示例

PATH

伪参数与Ref函数一起使用,但每个参数均定义为单独的对象in Troposphere

# Region and AccountId are pseudo parameters
from troposphere import Join, Region, AccountId

cloudwatch_log_arn = Join(
    ":", ["arn", "aws", "logs", Region, AccountId, "log-group", "log-name"]
)

因此,可以像上面的示例一样直接导入和使用它们。