Skip to content

Commit 8f5de70

Browse files
committed
Revert "docs: remove global db related documentation (#1238)"
This reverts commit 8679854.
1 parent 3ae4538 commit 8f5de70

9 files changed

Lines changed: 201 additions & 1 deletion

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ The following table lists the connection properties used with the AWS Advanced P
8888
| `topology_refresh_ms` | [Driver Parameters](docs/using-the-python-wrapper/UsingThePythonWrapper.md#aws-advanced-python-wrapper-parameters) |
8989
| `cluster_id` | [Driver Parameters](docs/using-the-python-wrapper/UsingThePythonWrapper.md#aws-advanced-python-wrapper-parameters) |
9090
| `cluster_instance_host_pattern` | [Driver Parameters](docs/using-the-python-wrapper/UsingThePythonWrapper.md#aws-advanced-python-wrapper-parameters) |
91+
| `global_cluster_instance_host_patterns` | [Failover v2 Plugin](docs/using-the-python-wrapper/UsingThePythonWrapper.md#aws-advanced-python-wrapper-parameters) |
9192
| `wrapper_dialect` | [Dialects](docs/using-the-python-wrapper/DatabaseDialects.md), and whether you should include it. |
9293
| `wrapper_driver_dialect` | [Driver Dialect](./docs/using-the-python-wrapper/DriverDialects.md), and whether you should include it. |
9394
| `plugins` | [Connection Plugin Manager](docs/using-the-python-wrapper/UsingThePythonWrapper.md#connection-plugin-manager-parameters) |

‎docs/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Database Dialects](using-the-python-wrapper/DatabaseDialects.md)
1010
- [Driver Dialects](using-the-python-wrapper/DriverDialects.md)
1111
- [Cluster ID](using-the-python-wrapper/ClusterId.md)
12+
- [Aurora Global Databases](using-the-python-wrapper/GlobalDatabases.md)
1213
- [Telemetry](using-the-python-wrapper/Telemetry.md)
1314
- [Plugins](using-the-python-wrapper/UsingThePythonWrapper.md#plugins)
1415
- [Failover Plugin](using-the-python-wrapper/using-plugins/UsingTheFailoverPlugin.md)

‎docs/using-the-python-wrapper/DatabaseDialects.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Dialect codes specify what kind of database any connections will be made to.
2323
| Dialect Code Reference | Value | Database |
2424
|------------------------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
2525
| `AURORA_MYSQL` | `aurora-mysql` | Aurora MySQL |
26+
| `GLOBAL_AURORA_MYSQL` | `global-aurora-mysql` | [Aurora Global Database MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-getting-started.html) |
2627
| `RDS_MULTI_AZ_MYSQL_CLUSTER` | `rds-multi-az-mysql-cluster` | [Amazon RDS MySQL Multi-AZ DB Cluster Deployments](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html) |
2728
| `RDS_MYSQL` | `rds-mysql` | Amazon RDS MySQL |
2829
| `MYSQL` | `mysql` | MySQL |
2930
| `AURORA_PG` | `aurora-pg` | Aurora PostgreSQL |
31+
| `GLOBAL_AURORA_PG` | `global-aurora-pg` | [Aurora Global Database PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-getting-started.html) |
3032
| `RDS_MULTI_AZ_PG_CLUSTER` | `rds-multi-az-pg-cluster` | [Amazon RDS PostgreSQL Multi-AZ DB Cluster Deployments](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html) |
3133
| `RDS_PG` | `rds-pg` | Amazon RDS PostgreSQL |
3234
| `PG` | `pg` | PostgreSQL |
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Aurora Global Databases
2+
3+
The AWS Advanced Python Wrapper provides support for [Amazon Aurora Global Databases](https://aws.amazon.com/rds/aurora/global-database/).
4+
5+
## Overview
6+
7+
Aurora Global Database is a feature that allows a single Aurora database to span multiple AWS regions. It provides fast replication across regions with minimal impact on database performance, enabling disaster recovery and serving read traffic from multiple regions.
8+
9+
The AWS Advanced Python Wrapper supports Global Writer Endpoint recognition.
10+
11+
## Configuration
12+
13+
The following instructions are recommended by AWS Service Teams for Aurora Global Database connections.
14+
15+
### Writer Connections
16+
17+
**Connection String:**
18+
Use the global cluster endpoint:
19+
```
20+
<global-db-name>.global-<XYZ>.global.rds.amazonaws.com
21+
```
22+
23+
**Configuration Parameters:**
24+
25+
| Parameter | Value | Notes |
26+
|------------------------------------------|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
27+
| `cluster_id` | `1` | See [cluster_id parameter documentation](./ClusterId.md) |
28+
| `wrapper_dialect` | `global-aurora-mysql` or `global-aurora-pg` | |
29+
| `plugins` | `initial_connection,failover2,efm2` | Without connection pooling |
30+
| | `aurora_connection_tracker,initial_connection,failover2,efm2` | With connection pooling |
31+
| `global_cluster_instance_host_patterns` | `us-east-2:?.XYZ1.us-east-2.rds.amazonaws.com,us-west-2:?.XYZ2.us-west-2.rds.amazonaws.com` | See [documentation](./using-plugins/UsingTheFailover2Plugin.md) |
32+
33+
> **Note:** Add additional plugins as needed for your use case.
34+
35+
### Reader Connections
36+
37+
**Connection String:**
38+
Use the cluster reader endpoint:
39+
```
40+
<cluster-name>.cluster-ro-<XYZ>.<region>.rds.amazonaws.com
41+
```
42+
43+
**Configuration Parameters:**
44+
45+
| Parameter | Value | Notes |
46+
|------------------------------------------|--------------------------------------------------------------------------------|------------------------------------------|
47+
| `cluster_id` | `1` | Use the same value as writer connections |
48+
| `wrapper_dialect` | `global-aurora-mysql` or `global-aurora-pg` | |
49+
| `plugins` | `initial_connection,failover2,efm2` | Without connection pooling |
50+
| | `aurora_connection_tracker,initial_connection,failover2,efm2` | With connection pooling |
51+
| `global_cluster_instance_host_patterns` | Same as writer configuration | |
52+
| `failover_mode` | `strict-reader` or `reader-or-writer` | Depending on system requirements |
53+
54+
> **Note:** Add additional plugins as needed for your use case.
55+
56+
## Example Configuration
57+
58+
### PostgreSQL Example
59+
60+
```python
61+
from aws_advanced_python_wrapper import AwsWrapperConnection
62+
from psycopg import Connection
63+
64+
# Writer connection
65+
with AwsWrapperConnection.connect(
66+
Connection.connect,
67+
"host=my-global-db.global-xyz.global.rds.amazonaws.com dbname=mydb user=admin password=pwd",
68+
plugins="initial_connection,failover2,efm2",
69+
wrapper_dialect="global-aurora-pg",
70+
cluster_id="1",
71+
global_cluster_instance_host_patterns="us-east-1:?.abc123.us-east-1.rds.amazonaws.com,us-west-2:?.def456.us-west-2.rds.amazonaws.com",
72+
autocommit=True
73+
) as awsconn:
74+
awscursor = awsconn.cursor()
75+
awscursor.execute("SELECT pg_catalog.aurora_db_instance_identifier()")
76+
print(awscursor.fetchone())
77+
78+
# Reader connection
79+
with AwsWrapperConnection.connect(
80+
Connection.connect,
81+
"host=my-cluster.cluster-ro-abc123.us-east-1.rds.amazonaws.com dbname=mydb user=admin password=pwd",
82+
plugins="initial_connection,failover2,efm2",
83+
wrapper_dialect="global-aurora-pg",
84+
cluster_id="1",
85+
global_cluster_instance_host_patterns="us-east-1:?.abc123.us-east-1.rds.amazonaws.com,us-west-2:?.def456.us-west-2.rds.amazonaws.com",
86+
failover_mode="strict-reader",
87+
autocommit=True
88+
) as awsconn:
89+
awscursor = awsconn.cursor()
90+
awscursor.execute("SELECT pg_catalog.aurora_db_instance_identifier()")
91+
print(awscursor.fetchone())
92+
```
93+
94+
### MySQL Example
95+
96+
```python
97+
from aws_advanced_python_wrapper import AwsWrapperConnection
98+
from mysql.connector import Connect
99+
100+
# Writer connection
101+
with AwsWrapperConnection.connect(
102+
Connect,
103+
"host=my-global-db.global-xyz.global.rds.amazonaws.com database=mydb user=admin password=pwd",
104+
plugins="initial_connection,failover2,efm2",
105+
wrapper_dialect="global-aurora-mysql",
106+
cluster_id="1",
107+
global_cluster_instance_host_patterns="us-east-1:?.abc123.us-east-1.rds.amazonaws.com,us-west-2:?.def456.us-west-2.rds.amazonaws.com",
108+
autocommit=True
109+
) as awsconn:
110+
awscursor = awsconn.cursor()
111+
awscursor.execute("SELECT @@aurora_server_id")
112+
print(awscursor.fetchone())
113+
```
114+
115+
## Important Considerations
116+
117+
### Plugin Selection
118+
- **Connection Pooling**: Include the `aurora_connection_tracker` plugin when using connection pooling.
119+
120+
### Global Cluster Instance Host Patterns
121+
The `global_cluster_instance_host_patterns` parameter is **required** for Aurora Global Databases. Each entry uses the format `<aws-region>:<host-pattern>` or `<aws-region>:<host-pattern>:<port>`. It should contain:
122+
- Comma-separated list of region-prefixed host patterns for each region
123+
- Different cluster identifiers for each region (e.g., `XYZ1`, `XYZ2`)
124+
- Example: `us-east-2:?.XYZ1.us-east-2.rds.amazonaws.com,us-west-2:?.XYZ2.us-west-2.rds.amazonaws.com`
125+
126+
### Authentication Plugins Compatible with GDB
127+
- [IAM Authentication Plugin](./using-plugins/UsingTheIamAuthenticationPlugin.md)
128+
- [Federated Authentication Plugin](./using-plugins/UsingTheFederatedAuthPlugin.md)
129+
- [Okta Authentication Plugin](./using-plugins/UsingTheOktaAuthPlugin.md)

‎docs/using-the-python-wrapper/UsingThePythonWrapper.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ These parameters are applicable to any instance of the AWS Advanced Python Wrapp
2828
| auxiliary_query_timeout_sec | Network timeout, in seconds, used for auxiliary queries to the database. This timeout applies to queries executed by the wrapper driver to gain info about the connected database. It does not apply to queries requested by the driver client. | False | 5 |
2929
| topology_refresh_ms | Cluster topology refresh rate in milliseconds. The cached topology for the cluster will be invalidated after the specified time, after which it will be updated during the next interaction with the connection. | False | 30000 |
3030
| cluster_id | A unique identifier for the cluster. Connections with the same cluster id share a cluster topology cache. If unspecified, a cluster id is automatically created for AWS RDS clusters. | False | None |
31-
| cluster_instance_host_pattern | The cluster instance DNS pattern that will be used to build a complete instance endpoint. A "?" character in this pattern should be used as a placeholder for cluster instance names. This pattern is required to be specified for IP address or custom domain connections to AWS RDS clusters. Otherwise, if unspecified, the pattern will be automatically created for AWS RDS clusters. | False | 30000 |
31+
| cluster_instance_host_pattern | The cluster instance DNS pattern that will be used to build a complete instance endpoint. A "?" character in this pattern should be used as a placeholder for cluster instance names. This pattern is required to be specified for IP address or custom domain connections to AWS RDS clusters. Otherwise, if unspecified, the pattern will be automatically created for AWS RDS clusters. | False | None |
32+
| global_cluster_instance_host_patterns | A comma-separated list of instance host patterns for Aurora Global Databases, with entries in the format `<aws-region>:<host-pattern>` or `<aws-region>:<host-pattern>:<port>`. A "?" character in the host pattern should be used as a placeholder for DB instance identifiers. The list should contain host patterns for each region of the global database. This parameter is required for Aurora Global Databases and is ignored for other database types. | False | None |
3233
| transfer_session_state_on_switch | Enables transferring the session state to a new connection. | False | `True` |
3334
| reset_session_state_on_close | Enables resetting the session state before closing connection. | False | `True` |
3435
| rollback_on_switch | Enables rolling back a current transaction, if any in effect, before switching to a new connection. | False | `True` |

0 commit comments

Comments
 (0)