Link to chapter - https://serverless-stack.com/chapters/deploy-the-resources-repo.html
Hi,
when you deploy the resources with the new sst setup, the table name does not contain “…-notes” anymore. Instead it’s some cryptic name. How would you define the table name.
Sincerely,
Thanks,
Instead of specifying the exact table name in our serverless.yml
, we import it.
I know, but where do we set it in the resources repo? Doesn’t seem to be set?
Would you need to set it in:
const table = new dynamodb.Table(this, "Table", {
billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, // Use on-demand billing mode
sortKey: { name: "noteId", type: dynamodb.AttributeType.STRING },
partitionKey: { name: "userId", type: dynamodb.AttributeType.STRING },
});
and add
tableName: 'your_tablename',
?
We just need to export the one that is automatically created.
Note the TableName
export here and the import that we have in the serverless.yml
.
You could hardcode it. But this way guarantees that won’t have any name collisions.