Skip to content

switchover_blue_green_deployment

switchover_blue_green_deployment(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    blue_green_deployment_identifier: Optional[BlueGreenDeploymentIdentifier] = None,
    switchover_timeout: Optional[SwitchoverTimeout] = None,
) -> SwitchoverBlueGreenDeploymentResponse

Switches over a blue/green deployment.

Before you switch over, production traffic is routed to the databases in the blue environment. After you switch over, production traffic is routed to the databases in the green environment.

For more information, see Using Amazon RDS Blue/Green Deployments for database updates in the Amazon RDS User Guide and Using Amazon RDS Blue/Green Deployments for database updates in the Amazon Aurora User Guide.

Parameters:

  • blue_green_deployment_identifier (Optional[BlueGreenDeploymentIdentifier], default: None ) –

    The resource ID of the blue/green deployment.

    Constraints:

    • Must match an existing blue/green deployment resource ID.

  • switchover_timeout (Optional[SwitchoverTimeout], default: None ) –

    The amount of time, in seconds, for the switchover to complete.

    Default: 300

    If the switchover takes longer than the specified duration, then any changes are rolled back, and no changes are made to the environments.

Raises:

Examples:

To switch a blue/green deployment for an RDS DB instance The following example promotes the specified green environment as the new production environment.

>>> client.switchover_blue_green_deployment(blue_green_deployment_identifier='bgd-wi89nwzglccsfake', switchover_timeout=300)
To promote a blue/green deployment for an Aurora MySQL DB cluster
The following example promotes the specified green environment as the new production environment.
>>> client.switchover_blue_green_deployment(blue_green_deployment_identifier='bgd-wi89nwzglccsfake', switchover_timeout=300)
Source code in docs_src/capo_rds/_services/rds.py
def switchover_blue_green_deployment(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    blue_green_deployment_identifier: Optional[
        "capo_rds.types.blue_green_deployment_identifier.BlueGreenDeploymentIdentifier"
    ] = None,
    switchover_timeout: Optional[
        "capo_rds.types.switchover_timeout.SwitchoverTimeout"
    ] = None,
) -> "capo_rds.types.switchover_blue_green_deployment_response.SwitchoverBlueGreenDeploymentResponse":
    """<p>Switches over a blue/green deployment.</p> <p>Before you switch over, production traffic is routed to the databases in the blue environment. After you switch over, production traffic is routed to the databases in the green environment.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html">Using Amazon RDS Blue/Green Deployments for database updates</a> in the <i>Amazon RDS User Guide</i> and <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html">Using Amazon RDS Blue/Green Deployments for database updates</a> in the <i>Amazon Aurora User Guide</i>.</p>

    Args:
        blue_green_deployment_identifier: <p>The resource ID of the blue/green deployment.</p> <p>Constraints:</p> <ul> <li> <p>Must match an existing blue/green deployment resource ID.</p> </li> </ul>
        switchover_timeout: <p>The amount of time, in seconds, for the switchover to complete.</p> <p>Default: 300</p> <p>If the switchover takes longer than the specified duration, then any changes are rolled back, and no changes are made to the environments.</p>

    Raises:
        capo_rds.errors.blue_green_deployment_not_found_fault.BlueGreenDeploymentNotFoundFault: <p> <code>BlueGreenDeploymentIdentifier</code> doesn't refer to an existing blue/green deployment.</p>
        capo_rds.errors.invalid_blue_green_deployment_state_fault.InvalidBlueGreenDeploymentStateFault: <p>The blue/green deployment can't be switched over or deleted because there is an invalid configuration in the green environment.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To switch a blue/green deployment for an RDS DB instance
        The following example promotes the specified green environment as the new production environment.

        >>> client.switchover_blue_green_deployment(blue_green_deployment_identifier='bgd-wi89nwzglccsfake', switchover_timeout=300)
        To promote a blue/green deployment for an Aurora MySQL DB cluster
        The following example promotes the specified green environment as the new production environment.

        >>> client.switchover_blue_green_deployment(blue_green_deployment_identifier='bgd-wi89nwzglccsfake', switchover_timeout=300)
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.switchover_blue_green_deployment_request.SwitchoverBlueGreenDeploymentRequest]",
    ) -> OperationResponse[
        "capo_rds.types.switchover_blue_green_deployment_response.SwitchoverBlueGreenDeploymentResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.switchover_blue_green_deployment

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SwitchoverBlueGreenDeployment")
    )
    input_: capo_rds.types.switchover_blue_green_deployment_request.SwitchoverBlueGreenDeploymentRequest = {}
    if blue_green_deployment_identifier is not None:
        input_["blue_green_deployment_identifier"] = (
            blue_green_deployment_identifier
        )
    if switchover_timeout is not None:
        input_["switchover_timeout"] = switchover_timeout

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