Skip to content

start_activity_stream async

start_activity_stream(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    resource_arn: Optional[String] = None,
    mode: Optional[ActivityStreamMode] = None,
    kms_key_id: Optional[String] = None,
    apply_immediately: Optional[BooleanOptional] = None,
    engine_native_audit_fields_included: Optional[BooleanOptional] = None,
) -> StartActivityStreamResponse

Starts a database activity stream to monitor activity on the database. For more information, see Monitoring Amazon Aurora with Database Activity Streams in the Amazon Aurora User Guide or Monitoring Amazon RDS with Database Activity Streams in the Amazon RDS User Guide.

Parameters:

  • resource_arn (Optional[String], default: None ) –

    The Amazon Resource Name (ARN) of the DB cluster, for example, arn:aws:rds:us-east-1:12345667890:cluster:das-cluster.

  • mode (Optional[ActivityStreamMode], default: None ) –

    Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously.

  • kms_key_id (Optional[String], default: None ) –

    The Amazon Web Services KMS key identifier for encrypting messages in the database activity stream. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.

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

    Specifies whether or not the database activity stream is to start as soon as possible, regardless of the maintenance window for the database.

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

    Specifies whether the database activity stream includes engine-native audit fields. This option applies to an Oracle or Microsoft SQL Server DB instance. By default, no engine-native audit fields are included.

Raises:

Examples:

To start a database activity stream The following example starts an asynchronous activity stream to monitor an Aurora cluster named my-pg-cluster.

>>> await client.start_activity_stream(resource_arn='arn:aws:rds:us-east-1:1234567890123:cluster:my-pg-cluster', mode='async', kms_key_id='arn:aws:kms:us-east-1:1234567890123:key/a12c345d-6ef7-890g-h123-456i789jk0l1', apply_immediately=True)
Source code in docs_src/capo_rds/_services/async_rds.py
async def start_activity_stream(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    resource_arn: Optional["capo_rds.types.string.String"] = None,
    mode: Optional["capo_rds.types.activity_stream_mode.ActivityStreamMode"] = None,
    kms_key_id: Optional["capo_rds.types.string.String"] = None,
    apply_immediately: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
    engine_native_audit_fields_included: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
) -> "capo_rds.types.start_activity_stream_response.StartActivityStreamResponse":
    """<p>Starts a database activity stream to monitor activity on the database. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/DBActivityStreams.html"> Monitoring Amazon Aurora with Database Activity Streams</a> in the <i>Amazon Aurora User Guide</i> or <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/DBActivityStreams.html"> Monitoring Amazon RDS with Database Activity Streams</a> in the <i>Amazon RDS User Guide</i>.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the DB cluster, for example, <code>arn:aws:rds:us-east-1:12345667890:cluster:das-cluster</code>.</p>
        mode: <p>Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously.</p>
        kms_key_id: <p>The Amazon Web Services KMS key identifier for encrypting messages in the database activity stream. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.</p>
        apply_immediately: <p>Specifies whether or not the database activity stream is to start as soon as possible, regardless of the maintenance window for the database.</p>
        engine_native_audit_fields_included: <p>Specifies whether the database activity stream includes engine-native audit fields. This option applies to an Oracle or Microsoft SQL Server DB instance. By default, no engine-native audit fields are included.</p>

    Raises:
        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_instance_not_found_fault.DBInstanceNotFoundFault: <p> <code>DBInstanceIdentifier</code> doesn't refer to an existing DB instance.</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.kms_key_not_accessible_fault.KMSKeyNotAccessibleFault: <p>An error occurred accessing an Amazon Web Services KMS key.</p>
        capo_rds.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The specified resource ID was not found.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To start a database activity stream
        The following example starts an asynchronous activity stream to monitor an Aurora cluster named my-pg-cluster.

        >>> await client.start_activity_stream(resource_arn='arn:aws:rds:us-east-1:1234567890123:cluster:my-pg-cluster', mode='async', kms_key_id='arn:aws:kms:us-east-1:1234567890123:key/a12c345d-6ef7-890g-h123-456i789jk0l1', apply_immediately=True)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.start_activity_stream_request.StartActivityStreamRequest]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.start_activity_stream_response.StartActivityStreamResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.start_activity_stream

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartActivityStream")
    )
    input_: capo_rds.types.start_activity_stream_request.StartActivityStreamRequest = {}
    if resource_arn is not None:
        input_["resource_arn"] = resource_arn
    if mode is not None:
        input_["mode"] = mode
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if apply_immediately is not None:
        input_["apply_immediately"] = apply_immediately
    if engine_native_audit_fields_included is not None:
        input_["engine_native_audit_fields_included"] = (
            engine_native_audit_fields_included
        )

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