微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我需要有关使用 CloudFormation 模板创建 DynamoDB 表的帮助

如何解决我需要有关使用 CloudFormation 模板创建 DynamoDB 表的帮助

我在使用 CloudFormation 模板创建 DynamoDB 表方面需要帮助。

表名:oeautomator-team-config 表架构:

活动 - 布尔值
devResolverGroups - 列表
excludeAgingList - 布尔值
excludeNoncontrollableList - 布尔值 excludeReroutedList - 布尔值
舰队 ID - 字符串 managerLogin - 字符串 metricsDashboardLinks - 地图 组织名称 - 字符串
simFolderId - 字符串 supportResolverGroups - 列表 团队名称 - 字符串

主分区键 - teamName(字符串)

我形成了一个模板

AWstemplateFormatVersion: 2010-09-09
Resources:
  oeautomatorteamconfigTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: oeautomator-team-config
      AttributeDeFinitions:
        - AttributeName: "teamName"
          AttributeType: "S"
      KeySchema:
        - AttributeName: "teamName"
          KeyType: "HASH"
      TimetoLiveSpecification:
        AttributeName: "ExpirationTime"
        Enabled: true
      ProvisionedThroughput:
        ReadCapacityUnits: "5"
        WriteCapacityUnits: "5"
    DependsOn:
      - DynamoDBQueryPolicy
  DynamoDBQueryPolicy:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyName: DynamoDBQueryPolicy
      PolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Action: "dynamodb:Query"
            Resource: "*"
      Roles:
        - Ref: "oeautomatorteamconfigTableQueryRole"

  oeautomatorteamconfigTableQueryRole:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Principal:
              Service:
                - "dynamodb.amazonaws.com"
            Action:
              - "sts:AssumeRole"
      Path: "/"

但不确定如何定义所有列的其余部分。

提前致谢

解决方法

您不需要指定其余的属性。除了哈希和范围键之外,Dynamo 的定义是 schemaless

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。