如何使AWS :: CloudFormation :: Stack作为参数转换dbname

时间:2019-01-09 06:37:30

标签: amazon-web-services types yaml amazon-cloudformation

我将AWS :: CloudFormation :: Stack用作嵌套堆栈,以避免aws中200个资源的限制。

我有嵌套堆栈想引用其他嵌套堆栈,因为我的数据堆栈包含很多DynamoDB表。

数据栈如下:

Resources:
  assets:
    Properties:
      AttributeDefinitions:
        - AttributeName: id
          AttributeType: S
        - AttributeName: version
          AttributeType: 'N'
        - AttributeName: bundleId
          AttributeType: S
      GlobalSecondaryIndexes:
        - IndexName: bundleId-index
          KeySchema:
            - AttributeName: bundleId
              KeyType: HASH
          Projection:
            ProjectionType: INCLUDE
            NonKeyAttributes:
              - type
          ProvisionedThroughput:
            ReadCapacityUnits: 5
            WriteCapacityUnits: 30
      KeySchema:
        - AttributeName: id
          KeyType: HASH
        - AttributeName: version
          KeyType: RANGE
      ProvisionedThroughput:
        ReadCapacityUnits: 2
        WriteCapacityUnits: 5
      SSESpecification:
        SSEEnabled: true
      TableName: !Join 
        - '-'
        - - !Ref prefix
          - !Ref deployenv
          - assets
    Type: 'AWS::DynamoDB::Table'
    ...
Outputs:
  tableassets:
    Description: Table assets
    Value: !Ref assets

我想像MyNestedStack是一个参数一样使用getatt:

Fn::GetAtt: [MyNestedStack, Outputs.tableassets]

获取表资产的资源。

如何定义MyNestedStack参数类型?

string参数类似于:

Parameters:
  deployenv:
    Type: String
    AllowedPattern: '[a-z]*[-a-z0-9]*'
    ConstraintDescription: A lower case string between 3 and 16 characters
    Description: A lower case string between 3 and 16 characters
    MinLength: 3
    MaxLength: 16

您可以看到Type是String,但是当我尝试使用AWS :: CloudFormation :: Stack作为参数时,它是什么类型? 您能给我完整的定义示例,并将堆栈对象作为参数引用吗?

0 个答案:

没有答案