问题描述
我在使用 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。