'Is there any way for adding multiple attributes to dynamodb table?

I have recently started with Dynamodb and Cloudformation and YAML, trying to understand more about it. Apologies if there is something I didn't get at first place. Please refer this code attaching for referrence,I am trying to add multiple attribute to a table but not able to do so

AWSTemplateFormatVersion: 2010-09-09
Description: AWS CFT To Create DynamoDB

Parameters:
  adminID:
    Type: String
    Default: adminId
    Description: adminId info
  adminIdType:
    Type: String
    Default: S
    Description: adminIdType info

  patientID:
    Type: String
    Default: patientID
    Description: patientID info
  patientIdType:
    Type: String
    Default: S
    Description: patientIdType info

  centerName:
    Type: String
    Default: centerName
    Description: centerName info
  centerNameType:
    Type: String
    Default: S
    Description: centerNameType info

  claimNumber:
    Type: String
    Default: claimNumber
    Description: claimNumber info
  claimNumberType:
    Type: String
    Default: S
    Description: claimNumberType

  technicianName:
    Type: String
    Default: technicianName
    Description: technicianName info
  technicianNameType:
    Type: String
    Default: S
    Description: technicianNameType



Resources:
  # creating table "Patient"
  PatientDetails:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: PatientDetails
      AttributeDefinitions:
        - AttributeName: !Ref adminID
          AttributeType: !Ref adminIdType
        - AttributeName: !Ref patientID
          AttributeType: !Ref patientIdType
        - AttributeName: !Ref centerName
          AttributeType: !Ref centerNameType
        - AttributeName: !Ref claimNumber
          AttributeType: !Ref claimNumberType
        - AttributeName: !Ref technicianName
          AttributeType: !Ref technicianNameType


      KeySchema:
        - AttributeName: !Ref adminID
          KeyType: HASH
        - AttributeName: !Ref patientID
          KeyType: RANGE
        - AttributeName: !Ref centerName
          KeyType: RANGE
        - AttributeName: !Ref claimNumber
          KeyType: RANGE
        - AttributeName: !Ref technicianName
          KeyType: RANGE

 
      ProvisionedThroughput:
        ReadCapacityUnits: 1
        WriteCapacityUnits: 1


  CenterDetails:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: CenterDetails
      AttributeDefinitions:
        - AttributeName: !Ref centerName
          AttributeType: !Ref centerNameType
      KeySchema:
        - AttributeName: !Ref centerName
          KeyType: HASH
      ProvisionedThroughput:
        ReadCapacityUnits: 1
        WriteCapacityUnits: 1

  TechnicianDetails:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: TechnicianDetails
      AttributeDefinitions:
        - AttributeName: !Ref technicianName
          AttributeType: !Ref technicianNameType
      KeySchema:
        - AttributeName: !Ref technicianName
          KeyType: HASH
      ProvisionedThroughput:
        ReadCapacityUnits: 1
        WriteCapacityUnits: 1


Outputs:
  PatientDetails:
    Description: Table Created using this Template
    Value: !Ref PatientDetails
  CenterDetails:
    Value: !Ref CenterDetails
  TechnicianDetails:
    Value: !Ref TechnicianDetails

Error: 1 validation error detected: Value '[KeySchemaElement(attributeName=adminId, keyType=HASH), KeySchemaElement(attributeName=patientID, keyType=RANGE), KeySchemaElement(attributeName=centerName, keyType=RANGE), KeySchemaElement(attributeName=claimNumber, keyType=RANGE), KeySchemaElement(attributeName=technicianName, keyType=RANGE)]' at 'keySchema' failed to satisfy constraint: Member must have length less than or equal to 2 (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: BOQH7ELVO8A5KT406LKS9QUCO3VV4KQNSO5AEMVJF66Q9ASUAAJG; Proxy: null)

What I am trying is to create multiple tables + 1st table PatientDetails is not supporting multiple attributes. How can I achieve this? Please help. Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source