Value of property SubnetIds must be of type List of String error

Solution 1:

This looks like a template formatting issue.

Also the SubnetIds property is only supported by Interface and Gateway Load Balancer VPC endpoint types. For the Gateway type you can not use this property, so you need to remove it:

  VPCEndpointGateway:
      Type: AWS::EC2::VPCEndpoint
      Properties:
        VpcId: !Ref VpcId
        ServiceName: !Ref dynamoDbEndPointServiceName
        VpcEndpointType: Gateway
        PrivateDnsEnabled: true
        SecurityGroupIds:
          - !Ref cacheSecurityGroup

For more information check the AWS::EC2::VPCEndpoint doc