【问题标题】:Valid Attributes for Resources Created by CloudFormationCloudFormation 创建的资源的有效属性
【发布时间】:2020-01-09 15:26:27
【问题描述】:

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”的有效属性?

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

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

    首先解释!Ref 函数,然后解释!GetAtt 属性(如果有的话)(AWS::ApiGateway::Deployment 不是这种情况)。

    在您的特定情况下,您可以将阶段名称作为模板中的参数传递,!Ref 它同时用于ApiDefaultDeploymentApiUsagePlan

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-07
      • 2020-11-09
      • 2018-07-15
      • 2017-12-23
      • 2018-01-12
      • 2020-09-30
      • 1970-01-01
      • 2020-01-22
      相关资源
      最近更新 更多