Jos*_*han 9 amazon-web-services aws-cloudformation amazon-dynamodb serverless-framework serverless
我有以下错误.
无服务器:操作失败!
Serverless Error ---------------------------------------
An error occurred: phoneNumberTable - CloudFormation cannot update a stack when a custom-named resource requires replacing. Rename mysite-api-phonenumber-dev and update the stack again…
Run Code Online (Sandbox Code Playgroud)
我尝试删除数据库,看看它是否可以重新创建它,但它仍然给出相同的错误,不会重制数据库?我该怎么办?
我所做的最近在我的serverless.yml文件中更改了以下资源.
phoneNumberTable: #This table is used to track phone numbers used in the system
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.phoneNumberTable}
AttributeDefinitions: #UserID in this case will be created once and constantly updated as it changes with status regarding the user.
- AttributeName: phoneNumber
AttributeType: S
KeySchema:
- AttributeName: phoneNumber
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: ${self:custom.dynamoDbCapacityUnits.${self:custom.pstage}}
WriteCapacityUnits: ${self:custom.dynamoDbCapacityUnits.${self:custom.pstage}}
Run Code Online (Sandbox Code Playgroud)
我在复制和粘贴时不小心使用userId创建了它,因此我将其更改为phoneNumber以获取哈希键,但此更改现在不会反映出来!
编辑::
我找到了一个解决方案,但它太可怕了.如果我执行sls删除--stage dev它将删除我的舞台的所有内容,但字面上一切...然后我必须执行sls deploy --stage dev再次开始部署,同时我的数据库被清除所有数据...不得不以某种方式更好的方式.
小智 7
AWS推荐的解决方案是重命名:https: //aws.amazon.com/premiumsupport/knowledge-center/cloudformation-custom-name/
| 归档时间: |
|
| 查看次数: |
4020 次 |
| 最近记录: |