在AWS CloudFormation中,可以使用AttributeType属性来定义DynamoDB表中的属性类型。对于Boolean数据类型,可以使用"B"作为AttributeType的值,对于List数据类型,可以使用"L"作为AttributeType的值。
以下是一个示例CloudFormation模板,其中定义了一个具有Boolean和List属性类型的DynamoDB表:
Resources:
MyDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: MyTable
AttributeDefinitions:
- AttributeName: MyBooleanAttribute
AttributeType: B
- AttributeName: MyListAttribute
AttributeType: L
KeySchema:
- AttributeName: MyBooleanAttribute
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
上述示例中,定义了一个名为"MyTable"的DynamoDB表。表中包含两个属性:MyBooleanAttribute和MyListAttribute。MyBooleanAttribute属性的类型为Boolean(B),而MyListAttribute属性的类型为List(L)。
注意,以上示例只是一个简单的示例,你可以根据自己的需求来定义更多的属性和其他属性类型。