Skip to content

create_blue_green_deployment async

create_blue_green_deployment(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    blue_green_deployment_name: Optional[BlueGreenDeploymentName] = None,
    source: Optional[DatabaseArn] = None,
    target_engine_version: Optional[TargetEngineVersion] = None,
    target_db_parameter_group_name: Optional[TargetDBParameterGroupName] = None,
    target_db_cluster_parameter_group_name: Optional[
        TargetDBClusterParameterGroupName
    ] = None,
    tags: Optional[TagList] = None,
    target_db_instance_class: Optional[TargetDBInstanceClass] = None,
    upgrade_target_storage_config: Optional[BooleanOptional] = None,
    target_iops: Optional[IntegerOptional] = None,
    target_storage_type: Optional[TargetStorageType] = None,
    target_allocated_storage: Optional[IntegerOptional] = None,
    target_storage_throughput: Optional[IntegerOptional] = None,
    target_resource_configurations: Optional[TargetResourceConfigurationList] = None,
) -> CreateBlueGreenDeploymentResponse

Creates a blue/green deployment.

A blue/green deployment creates a staging environment that copies the production environment. In a blue/green deployment, the blue environment is the current production environment. The green environment is the staging environment, and it stays in sync with the current production environment.

You can make changes to the databases in the green environment without affecting production workloads. For example, you can upgrade the major or minor DB engine version, change database parameters, or make schema changes in the staging environment. You can thoroughly test changes in the green environment. When ready, you can switch over the environments to promote the green environment to be the new production environment. The switchover typically takes under a minute.

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_name (Optional[BlueGreenDeploymentName], default: None ) –

    The name of the blue/green deployment.

    Constraints:

    • Can't be the same as an existing blue/green deployment name in the same account and Amazon Web Services Region.

  • source (Optional[DatabaseArn], default: None ) –

    The Amazon Resource Name (ARN) of the source production database.

    Specify the database that you want to clone. The blue/green deployment creates this database in the green environment. You can make updates to the database in the green environment, such as an engine version upgrade. When you are ready, you can switch the database in the green environment to be the production database.

  • target_engine_version (Optional[TargetEngineVersion], default: None ) –

    The engine version of the database in the green environment.

    Specify the engine version to upgrade to in the green environment.

  • target_db_parameter_group_name (Optional[TargetDBParameterGroupName], default: None ) –

    The DB parameter group associated with the DB instance in the green environment.

    To test parameter changes, specify a DB parameter group that is different from the one associated with the source DB instance.

  • target_db_cluster_parameter_group_name (Optional[TargetDBClusterParameterGroupName], default: None ) –

    The DB cluster parameter group associated with the Aurora DB cluster in the green environment.

    To test parameter changes, specify a DB cluster parameter group that is different from the one associated with the source DB cluster.

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

    Tags to assign to the blue/green deployment.

  • target_db_instance_class (Optional[TargetDBInstanceClass], default: None ) –

    Specify the DB instance class for the databases in the green environment.

    This parameter only applies to RDS DB instances, because DB instances within an Aurora DB cluster can have multiple different instance classes. If you're creating a blue/green deployment from an Aurora DB cluster, don't specify this parameter. After the green environment is created, you can individually modify the instance classes of the DB instances within the green DB cluster.

  • upgrade_target_storage_config (Optional[BooleanOptional], default: None ) –

    Whether to upgrade the storage file system configuration on the green database. This option migrates the green DB instance from the older 32-bit file system to the preferred configuration. For more information, see Upgrading the storage file system for a DB instance.

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

    The amount of Provisioned IOPS (input/output operations per second) to allocate for the green DB instance. For information about valid IOPS values, see Amazon RDS DB instance storage in the Amazon RDS User Guide.

    This setting doesn't apply to Amazon Aurora blue/green deployments.

  • target_storage_type (Optional[TargetStorageType], default: None ) –

    The storage type to associate with the green DB instance.

    Valid Values: gp2 | gp3 | io1 | io2

    This setting doesn't apply to Amazon Aurora blue/green deployments.

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

    The amount of storage in gibibytes (GiB) to allocate for the green DB instance. You can choose to increase or decrease the allocated storage on the green DB instance.

    This setting doesn't apply to Amazon Aurora blue/green deployments.

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

    The storage throughput value for the green DB instance.

    This setting applies only to the gp3 storage type.

    This setting doesn't apply to Amazon Aurora blue/green deployments.

  • target_resource_configurations (Optional[TargetResourceConfigurationList], default: None ) –

    Specifies resource-level configuration overrides for the green environment.

    Each entry identifies a resource in the blue environment by its Amazon Resource Name (ARN). It defines the desired configuration for the corresponding resource in the green environment. Any resource that you don't include in this parameter retains the same configuration as its counterpart in the blue environment.

    Use this parameter when one or more resources in the green environment require a different configuration than what they have in the blue environment.

    Constraints:

    • You can't specify the same SourceArn in more than one entry.

Raises:

Examples:

To create a blue/green deployment for an RDS for MySQL DB instance The following example creates a blue/green deployment for a MySQL DB instance.

>>> await client.create_blue_green_deployment(blue_green_deployment_name='bgd-test-instance', source='arn:aws:rds:us-east-1:123456789012:db:my-db-instance', target_engine_version='8.0', target_db_parameter_group_name='mysql-80-group')
To create a blue/green deployment for an Aurora MySQL DB cluster
The following example creates a blue/green deployment for an Aurora MySQL DB cluster.
>>> await client.create_blue_green_deployment(blue_green_deployment_name='my-blue-green-deployment', source='arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster', target_engine_version='8.0', target_db_parameter_group_name='ams-80-binlog-enabled', target_db_cluster_parameter_group_name='mysql-80-cluster-group')
Source code in docs_src/capo_rds/_services/async_rds.py
async def create_blue_green_deployment(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    blue_green_deployment_name: Optional[
        "capo_rds.types.blue_green_deployment_name.BlueGreenDeploymentName"
    ] = None,
    source: Optional["capo_rds.types.database_arn.DatabaseArn"] = None,
    target_engine_version: Optional[
        "capo_rds.types.target_engine_version.TargetEngineVersion"
    ] = None,
    target_db_parameter_group_name: Optional[
        "capo_rds.types.target_db_parameter_group_name.TargetDBParameterGroupName"
    ] = None,
    target_db_cluster_parameter_group_name: Optional[
        "capo_rds.types.target_db_cluster_parameter_group_name.TargetDBClusterParameterGroupName"
    ] = None,
    tags: Optional["capo_rds.types.tag_list.TagList"] = None,
    target_db_instance_class: Optional[
        "capo_rds.types.target_db_instance_class.TargetDBInstanceClass"
    ] = None,
    upgrade_target_storage_config: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
    target_iops: Optional["capo_rds.types.integer_optional.IntegerOptional"] = None,
    target_storage_type: Optional[
        "capo_rds.types.target_storage_type.TargetStorageType"
    ] = None,
    target_allocated_storage: Optional[
        "capo_rds.types.integer_optional.IntegerOptional"
    ] = None,
    target_storage_throughput: Optional[
        "capo_rds.types.integer_optional.IntegerOptional"
    ] = None,
    target_resource_configurations: Optional[
        "capo_rds.types.target_resource_configuration_list.TargetResourceConfigurationList"
    ] = None,
) -> "capo_rds.types.create_blue_green_deployment_response.CreateBlueGreenDeploymentResponse":
    """<p>Creates a blue/green deployment.</p> <p>A blue/green deployment creates a staging environment that copies the production environment. In a blue/green deployment, the blue environment is the current production environment. The green environment is the staging environment, and it stays in sync with the current production environment.</p> <p>You can make changes to the databases in the green environment without affecting production workloads. For example, you can upgrade the major or minor DB engine version, change database parameters, or make schema changes in the staging environment. You can thoroughly test changes in the green environment. When ready, you can switch over the environments to promote the green environment to be the new production environment. The switchover typically takes under a minute.</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_name: <p>The name of the blue/green deployment.</p> <p>Constraints:</p> <ul> <li> <p>Can't be the same as an existing blue/green deployment name in the same account and Amazon Web Services Region.</p> </li> </ul>
        source: <p>The Amazon Resource Name (ARN) of the source production database.</p> <p>Specify the database that you want to clone. The blue/green deployment creates this database in the green environment. You can make updates to the database in the green environment, such as an engine version upgrade. When you are ready, you can switch the database in the green environment to be the production database.</p>
        target_engine_version: <p>The engine version of the database in the green environment.</p> <p>Specify the engine version to upgrade to in the green environment.</p>
        target_db_parameter_group_name: <p>The DB parameter group associated with the DB instance in the green environment.</p> <p>To test parameter changes, specify a DB parameter group that is different from the one associated with the source DB instance.</p>
        target_db_cluster_parameter_group_name: <p>The DB cluster parameter group associated with the Aurora DB cluster in the green environment.</p> <p>To test parameter changes, specify a DB cluster parameter group that is different from the one associated with the source DB cluster.</p>
        tags: <p>Tags to assign to the blue/green deployment.</p>
        target_db_instance_class: <p>Specify the DB instance class for the databases in the green environment.</p> <p>This parameter only applies to RDS DB instances, because DB instances within an Aurora DB cluster can have multiple different instance classes. If you're creating a blue/green deployment from an Aurora DB cluster, don't specify this parameter. After the green environment is created, you can individually modify the instance classes of the DB instances within the green DB cluster.</p>
        upgrade_target_storage_config: <p>Whether to upgrade the storage file system configuration on the green database. This option migrates the green DB instance from the older 32-bit file system to the preferred configuration. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.UpgradeFileSystem">Upgrading the storage file system for a DB instance</a>.</p>
        target_iops: <p>The amount of Provisioned IOPS (input/output operations per second) to allocate for the green DB instance. For information about valid IOPS values, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html">Amazon RDS DB instance storage</a> in the <i>Amazon RDS User Guide</i>.</p> <p>This setting doesn't apply to Amazon Aurora blue/green deployments.</p>
        target_storage_type: <p>The storage type to associate with the green DB instance.</p> <p>Valid Values: <code>gp2 | gp3 | io1 | io2</code> </p> <p>This setting doesn't apply to Amazon Aurora blue/green deployments.</p>
        target_allocated_storage: <p>The amount of storage in gibibytes (GiB) to allocate for the green DB instance. You can choose to increase or decrease the allocated storage on the green DB instance.</p> <p>This setting doesn't apply to Amazon Aurora blue/green deployments.</p>
        target_storage_throughput: <p>The storage throughput value for the green DB instance.</p> <p>This setting applies only to the <code>gp3</code> storage type.</p> <p>This setting doesn't apply to Amazon Aurora blue/green deployments.</p>
        target_resource_configurations: <p>Specifies resource-level configuration overrides for the green environment.</p> <p>Each entry identifies a resource in the blue environment by its Amazon Resource Name (ARN). It defines the desired configuration for the corresponding resource in the green environment. Any resource that you don't include in this parameter retains the same configuration as its counterpart in the blue environment.</p> <p>Use this parameter when one or more resources in the green environment require a different configuration than what they have in the blue environment.</p> <p>Constraints:</p> <ul> <li> <p>You can't specify the same <code>SourceArn</code> in more than one entry.</p> </li> </ul>

    Raises:
        capo_rds.errors.blue_green_deployment_already_exists_fault.BlueGreenDeploymentAlreadyExistsFault: <p>A blue/green deployment with the specified name already exists.</p>
        capo_rds.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing DB cluster.</p>
        capo_rds.errors.db_cluster_parameter_group_not_found_fault.DBClusterParameterGroupNotFoundFault: <p> <code>DBClusterParameterGroupName</code> doesn't refer to an existing DB cluster parameter group.</p>
        capo_rds.errors.db_cluster_quota_exceeded_fault.DBClusterQuotaExceededFault: <p>The user attempted to create a new DB cluster and the user has already reached the maximum allowed DB cluster quota.</p>
        capo_rds.errors.db_instance_not_found_fault.DBInstanceNotFoundFault: <p> <code>DBInstanceIdentifier</code> doesn't refer to an existing DB instance.</p>
        capo_rds.errors.db_parameter_group_not_found_fault.DBParameterGroupNotFoundFault: <p> <code>DBParameterGroupName</code> doesn't refer to an existing DB parameter group.</p>
        capo_rds.errors.instance_quota_exceeded_fault.InstanceQuotaExceededFault: <p>The request would result in the user exceeding the allowed number of DB instances.</p>
        capo_rds.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The requested operation can't be performed while the cluster is in this state.</p>
        capo_rds.errors.invalid_db_instance_state_fault.InvalidDBInstanceStateFault: <p>The DB instance isn't in a valid state.</p>
        capo_rds.errors.source_cluster_not_supported_fault.SourceClusterNotSupportedFault: <p>The source DB cluster isn't supported for a blue/green deployment.</p>
        capo_rds.errors.source_database_not_supported_fault.SourceDatabaseNotSupportedFault: <p>The source DB instance isn't supported for a blue/green deployment.</p>
        capo_rds.errors.storage_quota_exceeded_fault.StorageQuotaExceededFault: <p>The request would result in the user exceeding the allowed amount of storage available across all DB instances.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a blue/green deployment for an RDS for MySQL DB instance
        The following example creates a blue/green deployment for a MySQL DB instance.

        >>> await client.create_blue_green_deployment(blue_green_deployment_name='bgd-test-instance', source='arn:aws:rds:us-east-1:123456789012:db:my-db-instance', target_engine_version='8.0', target_db_parameter_group_name='mysql-80-group')
        To create a blue/green deployment for an Aurora MySQL DB cluster
        The following example creates a blue/green deployment for an Aurora MySQL DB cluster.

        >>> await client.create_blue_green_deployment(blue_green_deployment_name='my-blue-green-deployment', source='arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster', target_engine_version='8.0', target_db_parameter_group_name='ams-80-binlog-enabled', target_db_cluster_parameter_group_name='mysql-80-cluster-group')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.create_blue_green_deployment_request.CreateBlueGreenDeploymentRequest]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.create_blue_green_deployment_response.CreateBlueGreenDeploymentResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.create_blue_green_deployment

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.create_blue_green_deployment.async_create_blue_green_deployment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBlueGreenDeployment")
    )
    input_: capo_rds.types.create_blue_green_deployment_request.CreateBlueGreenDeploymentRequest = {}
    if blue_green_deployment_name is not None:
        input_["blue_green_deployment_name"] = blue_green_deployment_name
    if source is not None:
        input_["source"] = source
    if target_engine_version is not None:
        input_["target_engine_version"] = target_engine_version
    if target_db_parameter_group_name is not None:
        input_["target_db_parameter_group_name"] = target_db_parameter_group_name
    if target_db_cluster_parameter_group_name is not None:
        input_["target_db_cluster_parameter_group_name"] = (
            target_db_cluster_parameter_group_name
        )
    if tags is not None:
        input_["tags"] = tags
    if target_db_instance_class is not None:
        input_["target_db_instance_class"] = target_db_instance_class
    if upgrade_target_storage_config is not None:
        input_["upgrade_target_storage_config"] = upgrade_target_storage_config
    if target_iops is not None:
        input_["target_iops"] = target_iops
    if target_storage_type is not None:
        input_["target_storage_type"] = target_storage_type
    if target_allocated_storage is not None:
        input_["target_allocated_storage"] = target_allocated_storage
    if target_storage_throughput is not None:
        input_["target_storage_throughput"] = target_storage_throughput
    if target_resource_configurations is not None:
        input_["target_resource_configurations"] = target_resource_configurations

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output