Skip to content

create_db_proxy

create_db_proxy(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_proxy_name: Optional[DBProxyName] = None,
    engine_family: Optional[EngineFamily] = None,
    default_auth_scheme: Optional[DefaultAuthScheme] = None,
    auth: Optional[UserAuthConfigList] = None,
    role_arn: Optional[Arn] = None,
    vpc_subnet_ids: Optional[StringList] = None,
    vpc_security_group_ids: Optional[StringList] = None,
    require_tls: Optional[Boolean] = None,
    idle_client_timeout: Optional[IntegerOptional] = None,
    debug_logging: Optional[Boolean] = None,
    tags: Optional[TagList] = None,
    endpoint_network_type: Optional[EndpointNetworkType] = None,
    target_connection_network_type: Optional[TargetConnectionNetworkType] = None,
) -> CreateDBProxyResponse

Creates a new DB proxy.

Parameters:

  • db_proxy_name (Optional[DBProxyName], default: None ) –

    The identifier for the proxy. This name must be unique for all proxies owned by your Amazon Web Services account in the specified Amazon Web Services Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.

  • engine_family (Optional[EngineFamily], default: None ) –

    The kinds of databases that the proxy can connect to. This value determines which database network protocol the proxy recognizes when it interprets network traffic to and from the database. For Aurora MySQL, RDS for MariaDB, and RDS for MySQL databases, specify MYSQL. For Aurora PostgreSQL and RDS for PostgreSQL databases, specify POSTGRESQL. For RDS for Microsoft SQL Server, specify SQLSERVER.

  • default_auth_scheme (Optional[DefaultAuthScheme], default: None ) –

    The default authentication scheme that the proxy uses for client connections to the proxy and connections from the proxy to the underlying database. Valid values are NONE and IAM_AUTH. When set to IAM_AUTH, the proxy uses end-to-end IAM authentication to connect to the database. If you don't specify DefaultAuthScheme or specify this parameter as NONE, you must specify the Auth option.

  • auth (Optional[UserAuthConfigList], default: None ) –

    The authorization mechanism that the proxy uses.

  • role_arn (Optional[Arn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in Amazon Web Services Secrets Manager.

  • vpc_subnet_ids (Optional[StringList], default: None ) –

    One or more VPC subnet IDs to associate with the new proxy.

  • vpc_security_group_ids (Optional[StringList], default: None ) –

    One or more VPC security group IDs to associate with the new proxy.

  • require_tls (Optional[Boolean], default: None ) –

    Specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy. By enabling this setting, you can enforce encrypted TLS connections to the proxy.

  • idle_client_timeout (Optional[IntegerOptional], default: None ) –

    The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database.

  • debug_logging (Optional[Boolean], default: None ) –

    Specifies whether the proxy logs detailed connection and query information. When you enable DebugLogging, the proxy captures connection details and connection pool behavior from your queries. Debug logging increases CloudWatch costs and can impact proxy performance. Enable this option only when you need to troubleshoot connection or performance issues.

  • tags (Optional[TagList], default: None ) –

    An optional set of key-value pairs to associate arbitrary data of your choosing with the proxy.

  • endpoint_network_type (Optional[EndpointNetworkType], default: None ) –

    The network type of the DB proxy endpoint. The network type determines the IP version that the proxy endpoint supports.

    Valid values:

    • IPV4 - The proxy endpoint supports IPv4 only.

    • IPV6 - The proxy endpoint supports IPv6 only.

    • DUAL - The proxy endpoint supports both IPv4 and IPv6.

    Default: IPV4

    Constraints:

    • If you specify IPV6 or DUAL, the VPC and all subnets must have an IPv6 CIDR block.

    • If you specify IPV6 or DUAL, the VPC tenancy cannot be dedicated.

  • target_connection_network_type (Optional[TargetConnectionNetworkType], default: None ) –

    The network type that the proxy uses to connect to the target database. The network type determines the IP version that the proxy uses for connections to the database.

    Valid values:

    • IPV4 - The proxy connects to the database using IPv4 only.

    • IPV6 - The proxy connects to the database using IPv6 only.

    Default: IPV4

    Constraints:

    • If you specify IPV6, the database must support dual-stack mode. RDS doesn't support IPv6-only databases.

    • All targets registered with the proxy must be compatible with the specified network type.

Raises:

  • DBProxyAlreadyExistsFault –

    The specified proxy name must be unique for all proxies owned by your Amazon Web Services account in the specified Amazon Web Services Region.

  • DBProxyQuotaExceededFault –

    Your Amazon Web Services account already has the maximum number of proxies in the specified Amazon Web Services Region.

  • InvalidSubnet –

    The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_rds/_services/rds.py
def create_db_proxy(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_proxy_name: Optional["capo_rds.types.db_proxy_name.DBProxyName"] = None,
    engine_family: Optional["capo_rds.types.engine_family.EngineFamily"] = None,
    default_auth_scheme: Optional[
        "capo_rds.types.default_auth_scheme.DefaultAuthScheme"
    ] = None,
    auth: Optional[
        "capo_rds.types.user_auth_config_list.UserAuthConfigList"
    ] = None,
    role_arn: Optional["capo_rds.types.arn.Arn"] = None,
    vpc_subnet_ids: Optional["capo_rds.types.string_list.StringList"] = None,
    vpc_security_group_ids: Optional[
        "capo_rds.types.string_list.StringList"
    ] = None,
    require_tls: Optional["capo_rds.types.boolean.Boolean"] = None,
    idle_client_timeout: Optional[
        "capo_rds.types.integer_optional.IntegerOptional"
    ] = None,
    debug_logging: Optional["capo_rds.types.boolean.Boolean"] = None,
    tags: Optional["capo_rds.types.tag_list.TagList"] = None,
    endpoint_network_type: Optional[
        "capo_rds.types.endpoint_network_type.EndpointNetworkType"
    ] = None,
    target_connection_network_type: Optional[
        "capo_rds.types.target_connection_network_type.TargetConnectionNetworkType"
    ] = None,
) -> "capo_rds.types.create_db_proxy_response.CreateDBProxyResponse":
    """<p>Creates a new DB proxy.</p>

    Args:
        db_proxy_name: <p>The identifier for the proxy. This name must be unique for all proxies owned by your Amazon Web Services account in the specified Amazon Web Services Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.</p>
        engine_family: <p>The kinds of databases that the proxy can connect to. This value determines which database network protocol the proxy recognizes when it interprets network traffic to and from the database. For Aurora MySQL, RDS for MariaDB, and RDS for MySQL databases, specify <code>MYSQL</code>. For Aurora PostgreSQL and RDS for PostgreSQL databases, specify <code>POSTGRESQL</code>. For RDS for Microsoft SQL Server, specify <code>SQLSERVER</code>.</p>
        default_auth_scheme: <p>The default authentication scheme that the proxy uses for client connections to the proxy and connections from the proxy to the underlying database. Valid values are <code>NONE</code> and <code>IAM_AUTH</code>. When set to <code>IAM_AUTH</code>, the proxy uses end-to-end IAM authentication to connect to the database. If you don't specify <code>DefaultAuthScheme</code> or specify this parameter as <code>NONE</code>, you must specify the <code>Auth</code> option.</p>
        auth: <p>The authorization mechanism that the proxy uses.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in Amazon Web Services Secrets Manager.</p>
        vpc_subnet_ids: <p>One or more VPC subnet IDs to associate with the new proxy.</p>
        vpc_security_group_ids: <p>One or more VPC security group IDs to associate with the new proxy.</p>
        require_tls: <p>Specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy. By enabling this setting, you can enforce encrypted TLS connections to the proxy.</p>
        idle_client_timeout: <p>The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database.</p>
        debug_logging: <p>Specifies whether the proxy logs detailed connection and query information. When you enable <code>DebugLogging</code>, the proxy captures connection details and connection pool behavior from your queries. Debug logging increases CloudWatch costs and can impact proxy performance. Enable this option only when you need to troubleshoot connection or performance issues.</p>
        tags: <p>An optional set of key-value pairs to associate arbitrary data of your choosing with the proxy.</p>
        endpoint_network_type: <p>The network type of the DB proxy endpoint. The network type determines the IP version that the proxy endpoint supports.</p> <p>Valid values:</p> <ul> <li> <p> <code>IPV4</code> - The proxy endpoint supports IPv4 only.</p> </li> <li> <p> <code>IPV6</code> - The proxy endpoint supports IPv6 only.</p> </li> <li> <p> <code>DUAL</code> - The proxy endpoint supports both IPv4 and IPv6.</p> </li> </ul> <p>Default: <code>IPV4</code> </p> <p>Constraints:</p> <ul> <li> <p>If you specify <code>IPV6</code> or <code>DUAL</code>, the VPC and all subnets must have an IPv6 CIDR block.</p> </li> <li> <p>If you specify <code>IPV6</code> or <code>DUAL</code>, the VPC tenancy cannot be <code>dedicated</code>.</p> </li> </ul>
        target_connection_network_type: <p>The network type that the proxy uses to connect to the target database. The network type determines the IP version that the proxy uses for connections to the database.</p> <p>Valid values:</p> <ul> <li> <p> <code>IPV4</code> - The proxy connects to the database using IPv4 only.</p> </li> <li> <p> <code>IPV6</code> - The proxy connects to the database using IPv6 only.</p> </li> </ul> <p>Default: <code>IPV4</code> </p> <p>Constraints:</p> <ul> <li> <p>If you specify <code>IPV6</code>, the database must support dual-stack mode. RDS doesn't support IPv6-only databases.</p> </li> <li> <p>All targets registered with the proxy must be compatible with the specified network type.</p> </li> </ul>

    Raises:
        capo_rds.errors.db_proxy_already_exists_fault.DBProxyAlreadyExistsFault: <p>The specified proxy name must be unique for all proxies owned by your Amazon Web Services account in the specified Amazon Web Services Region.</p>
        capo_rds.errors.db_proxy_quota_exceeded_fault.DBProxyQuotaExceededFault: <p>Your Amazon Web Services account already has the maximum number of proxies in the specified Amazon Web Services Region.</p>
        capo_rds.errors.invalid_subnet.InvalidSubnet: <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.create_db_proxy_request.CreateDBProxyRequest]",
    ) -> OperationResponse[
        "capo_rds.types.create_db_proxy_response.CreateDBProxyResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.create_db_proxy

        output, http_response = (
            capo_rds._operations.amazon_rd_sv19.create_db_proxy.create_db_proxy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDBProxy")
    )
    input_: capo_rds.types.create_db_proxy_request.CreateDBProxyRequest = {}
    if db_proxy_name is not None:
        input_["db_proxy_name"] = db_proxy_name
    if engine_family is not None:
        input_["engine_family"] = engine_family
    if default_auth_scheme is not None:
        input_["default_auth_scheme"] = default_auth_scheme
    if auth is not None:
        input_["auth"] = auth
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if vpc_subnet_ids is not None:
        input_["vpc_subnet_ids"] = vpc_subnet_ids
    if vpc_security_group_ids is not None:
        input_["vpc_security_group_ids"] = vpc_security_group_ids
    if require_tls is not None:
        input_["require_tls"] = require_tls
    if idle_client_timeout is not None:
        input_["idle_client_timeout"] = idle_client_timeout
    if debug_logging is not None:
        input_["debug_logging"] = debug_logging
    if tags is not None:
        input_["tags"] = tags
    if endpoint_network_type is not None:
        input_["endpoint_network_type"] = endpoint_network_type
    if target_connection_network_type is not None:
        input_["target_connection_network_type"] = target_connection_network_type

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output