CloudFormation创建的资源的有效属性

时间:2019-09-06 18:59:11

标签: amazon-web-services amazon-cloudformation

CloudFormation包含Fn::GetAtt内部函数。我怎么知道给定资源可以使用哪些属性?

 ApiDefault:
  Type: "AWS::ApiGateway::RestApi"
  Properties:
   Name: "poc"
   Description: "Public interface for system-to-system order submissions."
   FailOnWarnings: true
 ApiDefaultDeployment:
  Type: AWS::ApiGateway::Deployment
  DependsOn:
   - "ApiMethodImageSubmitPost"
  Properties:
   Description: "Production environment supporting version-1 of the interface."
   RestApiId: !Ref "ApiDefault"
   StageName: "v1"
 ...
 ApiUsagePlan:
  Type: "AWS::ApiGateway::UsagePlan"
  Properties:
   ApiStages: 
   - ApiId: !Ref "ApiDefault"
     Stage: !GetAtt [ "ApiDefaultDeployment", "StageName" ]

在上面,“ StageName”不是有效的属性。那么,如何找到“ AWS :: ApiGateway :: Deployment”的有效属性?

1 个答案:

答案 0 :(得分:1)

在任何给定资源in the doc 返回值 部分中,通常在示例部分上方页面的末尾。

首先说明!Ref函数,然后说明!GetAtt属性(如果有)(AWS::ApiGateway::Deployment则不是)。

在特定情况下,您可以将阶段名称作为参数传递给模板,并为!RefApiDefaultDeployment ApiUsagePlan传递阶段名称。