> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Ddb table backup enabled remediation

### Triage and Remediation

<Tabs>
  <Tab title="Remediation">
    ### Remediation

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        To remediate the misconfiguration of DynamoDB tables not having continuous backup enabled in AWS using the AWS Management Console, follow these steps:

        1. **Login to AWS Console**: Go to the AWS Management Console ([https://aws.amazon.com/](https://aws.amazon.com/)) and log in to your account.

        2. **Navigate to DynamoDB**: Click on the "Services" dropdown menu at the top of the page, then select "DynamoDB" under the "Database" section.

        3. **Select the Table**: From the DynamoDB dashboard, select the table for which you want to enable continuous backups by clicking on its name.

        4. **Go to Backup Tab**: In the table details page, click on the "Backup" tab located in the top menu.

        5. **Enable Continuous Backup**: In the "Backup" tab, you will see an option to enable continuous backups. Click on the "Edit" button next to "Continuous Backups" to modify the settings.

        6. **Enable Backup**: In the "Edit continuous backups" window, enable the "On" option to turn on continuous backups for the selected table. You can also set the backup retention period as per your requirement.

        7. **Save Changes**: After enabling continuous backups and setting the retention period, click on the "Save changes" button to apply the configuration.

        8. **Verification**: Once saved, you should see a message confirming that continuous backups have been enabled for the DynamoDB table.

        By following these steps, you have successfully remediated the misconfiguration of DynamoDB tables not having continuous backups enabled in AWS using the AWS Management Console.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To remediate the misconfiguration of not having continuous backup enabled for an AWS DynamoDB table using AWS CLI, you can follow these steps:

        1. List all the DynamoDB tables to identify the table that needs to have continuous backup enabled:

        ```bash theme={null}
        aws dynamodb list-tables
        ```

        2. Enable continuous backups for the identified DynamoDB table using the following command:

        ```bash theme={null}
        aws dynamodb update-continuous-backups --table-name YOUR_TABLE_NAME --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true
        ```

        Replace `YOUR_TABLE_NAME` with the name of the DynamoDB table for which you want to enable continuous backups.

        3. Verify that continuous backups have been enabled for the table by describing the table:

        ```bash theme={null}
        aws dynamodb describe-continuous-backups --table-name YOUR_TABLE_NAME
        ```

        Make sure that the `PointInTimeRecoverySpecification` shows `PointInTimeRecoveryEnabled: true` for the table.

        By following these steps, you can successfully remediate the misconfiguration of not having continuous backup enabled for an AWS DynamoDB table using AWS CLI.
      </Accordion>

      <Accordion title="Using Python">
        To remediate the misconfiguration of not having continuous backup enabled for AWS DynamoDB tables using Python, you can follow these steps:

        1. Install the AWS SDK for Python (Boto3) if you haven't already. You can install it using pip:
           ```
           pip install boto3
           ```

        2. Use the following Python script to enable continuous backups for a DynamoDB table:

        ```python theme={null}
        import boto3

        # Initialize the DynamoDB client
        dynamodb = boto3.client('dynamodb')

        # Specify the name of the DynamoDB table for which you want to enable continuous backups
        table_name = 'YOUR_TABLE_NAME'

        # Enable continuous backups for the specified DynamoDB table
        response = dynamodb.update_continuous_backups(
            TableName=table_name,
            PointInTimeRecoverySpecification={
                'PointInTimeRecoveryEnabled': True
            }
        )

        # Print the response
        print(response)
        ```

        3. Replace `'YOUR_TABLE_NAME'` with the actual name of the DynamoDB table for which you want to enable continuous backups.

        4. Run the Python script. It will enable continuous backups for the specified DynamoDB table.

        After following these steps, continuous backups will be enabled for the specified DynamoDB table, thereby remediating the misconfiguration.
      </Accordion>

      <Accordion title="Using Terraform">
        ```hcl theme={null}
        resource "aws_dynamodb_table" "THIS_TABLE" {
          name         = "TABLE_NAME"          # replace with your DynamoDB table name
          billing_mode = "PAY_PER_REQUEST"     # or PROVISIONED, as appropriate
          hash_key     = "PARTITION_KEY_NAME"  # replace with your table's partition key

          attribute {
            name = "PARTITION_KEY_NAME"        # replace with your table's partition key
            type = "S"                         # adjust to "N" or "B" as needed
          }

          # Enable continuous backups via Point-in-time Recovery (PITR)
          point_in_time_recovery {
            enabled = true
          }
        }
        ```

        Enabling `point_in_time_recovery.enabled = true` turns on DynamoDB PITR and incurs additional costs; review DynamoDB pricing before applying. This change is an in-place update and does not force replacement of the table.

        To verify, `terraform plan` should show an in-place update on `aws_dynamodb_table.THIS_TABLE` with:

        * `point_in_time_recovery.enabled` changing from `false` (or `null`) to `true`.
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>
