Hi,
I am working on my second project using serverless framework. I did the first one using AWS and now I wanted to give it a try to Google Cloud Platform. Everything was going fine until I needed to create a database table to store some data.
I AWS I would have added this to my serverless.yml file:
resources:
Resources:
userEventsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: username
AttributeType: S
KeySchema:
- AttributeName: username
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: 'users'
But I have no idea what is the equivalent in GCP. After looking for a while in the google documentation, I found this: 지원되는 리소스 유형 | Cloud Deployment Manager 문서 | Google Cloud but no examples of specifically create a table.
I have tried with the following, as I thought I might need an instance before having a table:
resources: resources: - type: bigtableadmin.v2.instance name: my-serverless-service-instance
but then I get this error when deploying:
Serverless: Packaging service... Serverless: Excluding development dependencies... Serverless: Compiling function "slackDispatcher"... Serverless: Uploading artifacts... Serverless: Artifacts successfully uploaded... Serverless: Updating deployment... Serverless: Checking deployment update progress... Error -------------------------------------------------- Unexpected token M in JSON at position 0 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable. Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Forums: forum.serverless.com Chat: gitter.im/serverless/serverless Your Environment Information ----------------------------- OS: linux Node Version: 6.11.3 Serverless Version: 1.23.0
Does anyone know how to simply create a table in GCP the same way you would create a DynamoDB table in AWS?
Thanks