The "Deleting" status of a DynamoDB Table

0

Currently, I am using Terraform to create tables in DynamoDB. The tables I create all have the Deletion Protection attribute. After that, I use Terraform to recreate these tables. One of the tables encountered an issue where it could not be deleted due to the Deletion Protection setting. I then went to the AWS console to disable the Deletion Protection attribute. However, at this point, the table was in the Deleting status, so I couldn’t do anything with this table. Is there any solution to make the Deleting status disappear? I'm sorry for my poor English.

gefragt vor 3 Monaten256 Aufrufe
1 Antwort
1

Hi Boombala,

Please try this below solution i hope it will be helpful for you.

Check AWS Console and CLI:

  • First, check the AWS Management Console to see if the table is still in the "Deleting" status.
  • Use the AWS CLI to check the status of the table as well:
aws dynamodb describe-table --table-name <YourTableName>

  • This will give you the current status of the table.

Wait for the Deletion to Complete:

  • Sometimes, the deletion process can take some time. Wait for a few minutes and check the status again.

Retry Disabling Deletion Protection:

  • If the table is still in the "Deleting" status, try disabling the deletion protection again using the AWS CLI:
aws dynamodb update-table --table-name <YourTableName> --deletion-protection-enabled false

  • Then, attempt to delete the table again:
aws dynamodb delete-table --table-name <YourTableName>

Contact AWS Support:

  • If the table remains in the "Deleting" status for an extended period, it might require intervention from AWS Support. Open a support ticket with AWS, explaining the situation. Provide them with the table name and any relevant details.

Automate with Terraform:

  • Ensure your Terraform script handles the disabling of deletion protection before attempting to delete the table. You can add a step in your Terraform script to update the deletion protection attribute before the delete action.

Here's a brief Terraform example to update the deletion protection before deletion:

resource "aws_dynamodb_table" "example" {
  name           = "example-table"
  hash_key       = "example-key"
  billing_mode   = "PAY_PER_REQUEST"

  attribute {
    name = "example-key"
    type = "S"
  }

  deletion_protection_enabled = false

  lifecycle {
    ignore_changes = [deletion_protection_enabled]
  }
}

Then, you can apply the changes:

terraform apply

Finally, delete the table:

terraform destroy

EXPERTE
beantwortet vor 3 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen