> For the complete documentation index, see [llms.txt](https://newtons.gitbook.io/knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://newtons.gitbook.io/knowledge/dynamo-db/untitled.md).

# Deploy table after changing key schema

### Issue description

After changing dynamoDB table's key schema, deploying will throw an error:

> studentTable - CloudFormation cannot update a stack when a custom-named resource requires replacing. Rename studentTable and update the stack again..

### Working solution

Rename the table name in serverless.yml file from xxx to xxx2. Deploy and rename it back to xxx and deploy again and it should work.

### Tried solution

Delete the table and redeploy. Same error.

### Hint

If you set DeletionPolicy to Delete, this deployment process will delete the table with the old name. You can backup the table first and restore it later.

### Reference

[CloudFormation cannot update a stack when a custom-named resource requires replacing](https://forum.serverless.com/t/cloudformation-cannot-update-a-stack-when-a-custom-named-resource-requires-replacing/3217)
