> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/storage/appsec2-gcp-20.md).

# GCP SQL MySQL DB instance point-in-time recovery backup (Binary logs) is not enabled misconfiguratio

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_GCP\_20                     |
| Category - Subcategory | Storage - Backups                    |
| Provider               | GCP                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 8bdd1d25-660d-4a3d-be5a-c9a96e4b2bb6 |

## Impact

This rule is checking to ensure that a MySQL DB instance has a point-in-time recovery backup configured. Point-in-time recovery allows you to restore your database to any second during your retention period, up to the last five minutes. Not having this setup can be risky as it might result in data loss if there is an issue or outage. By not using point-in-time recovery backup, you are potentially putting your data at risk in the event of a disaster or data corruption issue. Therefore, it's crucial to have this backup configuration in place to safeguard your data.

## How to Fix

*Resource:* google\_sql\_database\_instance

* *Arguments:* database\_version, settings.backup\_configuration.binary\_log\_enabled

To fix this, you need to enable Point-In-Time Recovery (PITR) in your MySQL DB instance. Please ensure the `backup_window` and `backup_retention_period` attributes are configured optimally. Here's some example code:

## In the above example, we've enabled backups by setting `enabled` to `true` under `backup_configuration`. `binary_log_enabled` is also set to `true` to ensure binary logging (necessary for point-in-time recovery) is enabled. The `start_time` attribute is set to schedule the backup at a specific time. Also, `backup_retention_period` has been set to `30` days to hold backups. \[source,go]

resource "google\_sql\_database\_instance" "default" { name = "mysql-instance" region = "us-central1" database\_version = "MYSQL\_5\_6"

settings { tier = "db-f1-micro"

backup\_configuration { enabled = true

* binary\_log\_enabled = true start\_time = "05:00" // specify a convenient time } }

backup\_window { start\_time = "05:00" }

## backup\_retention\_period = 30 }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/storage/appsec2-gcp-20.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
