amazon-web-servicesaws-glueamazon-athenaserverless-framework

Creating Glue table with serverless.yaml gives 'Table name must not contain uppercase characters' error even if name is in lower case


I am trying to create a AWS Glue Database and Table using Serverless framework. Here is the yaml code that I have been using to test:

org: testorg
service: TestAthenaServerless

provider:
  name: aws
  runtime: nodejs20.x

functions:
  hello:
    handler: handler.hello
    events:
      - httpApi:
          path: /
          method: get

resources:
  Resources:
    ReportsBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: test-bucket
    TestDatabase:
      Type: AWS::Glue::Database
      Properties:
        DatabaseInput:
          Name: school_db
          Description: testing athena serverless 
        CatalogId: Ref AWS::AccountId
    StudentTable: 
      Type: AWS::Glue::Table
      Properties:
        DatabaseName: Ref TestDatabase
        CatalogId: Ref AWS::AccountId
        TableInput:
          Name: student_table
          Description: Serverless test table
          TableType: EXTERNAL_TABLE
          StorageDescriptor: 
            Columns:
            - {Name: student_name, Type: string}
            - {Name: student_id, Type: string}
            - {Name: roll_no, Type: string}
            - {Name: gender, Type: string}
            Location: s3://test-bucket/students
          Parameters: {}

As can be seen above, the table name is student_table that is all lower case. But deploying fails with error:

āœ– An error occurred: StudentTable - Table name [ student_table ] must not contain uppercase characters.
ServerlessError2: An error occurred: StudentTable - Table name [ student_table ] must not contain uppercase characters.

Can someone point me to where I am going wrong?

I tried changing the table name to a single word studenttable, using hyphen instead of underscore etc but end up with same error.


Solution

  • You must change your Ref ... references for !Ref .... that will fix it.