Skip to content

start_export_task async

start_export_task(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    export_task_identifier: Optional[String] = None,
    source_arn: Optional[String] = None,
    s3_bucket_name: Optional[String] = None,
    iam_role_arn: Optional[String] = None,
    kms_key_id: Optional[String] = None,
    s3_prefix: Optional[String] = None,
    export_only: Optional[StringList] = None,
) -> ExportTask

Starts an export of DB snapshot or DB cluster data to Amazon S3. The provided IAM role must have access to the S3 bucket.

You can't export snapshot data from RDS Custom DB instances. For more information, see Supported Regions and DB engines for exporting snapshots to S3 in Amazon RDS.

For more information on exporting DB snapshot data, see Exporting DB snapshot data to Amazon S3 in the Amazon RDS User Guide or Exporting DB cluster snapshot data to Amazon S3 in the Amazon Aurora User Guide.

For more information on exporting DB cluster data, see Exporting DB cluster data to Amazon S3 in the Amazon Aurora User Guide.

Parameters:

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

    A unique identifier for the export task. This ID isn't an identifier for the Amazon S3 bucket where the data is to be exported.

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

    The Amazon Resource Name (ARN) of the snapshot or cluster to export to Amazon S3.

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

    The name of the Amazon S3 bucket to export the snapshot or cluster data to.

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

    The name of the IAM role to use for writing to the Amazon S3 bucket when exporting a snapshot or cluster.

    In the IAM policy attached to your IAM role, include the following required actions to allow the transfer of files from Amazon RDS or Amazon Aurora to an S3 bucket:

    • s3:PutObject*

    • s3:GetObject*

    • s3:ListBucket

    • s3:DeleteObject*

    • s3:GetBucketLocation

    In the policy, include the resources to identify the S3 bucket and objects in the bucket. The following list of resources shows the Amazon Resource Name (ARN) format for accessing S3:

    • arn:aws:s3:::your-s3-bucket

    • arn:aws:s3:::your-s3-bucket/*

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

    The ID of the Amazon Web Services KMS key to use to encrypt the data exported to Amazon S3. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. The caller of this operation must be authorized to run the following operations. These can be set in the Amazon Web Services KMS key policy:

    • kms:CreateGrant

    • kms:DescribeKey

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

    The Amazon S3 bucket prefix to use as the file name and path of the exported data.

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

    The data to be exported from the snapshot or cluster. If this parameter isn't provided, all of the data is exported.

    Valid Values:

    • database - Export all the data from a specified database.

    • database.table table-name - Export a table of the snapshot or cluster. This format is valid only for RDS for MySQL, RDS for MariaDB, and Aurora MySQL.

    • database.schema schema-name - Export a database schema of the snapshot or cluster. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.

    • database.schema.table table-name - Export a table of the database schema. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.

Raises:

Examples:

To export a snapshot to Amazon S3 The following example exports a DB snapshot named db5-snapshot-test to the Amazon S3 bucket named mybucket.

>>> await client.start_export_task(export_task_identifier='my-s3-export', source_arn='arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test', s3_bucket_name='mybucket', iam_role_arn='arn:aws:iam::123456789012:role/service-role/ExportRole', kms_key_id='arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff')
Source code in docs_src/capo_rds/_services/async_rds.py
async def start_export_task(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    export_task_identifier: Optional["capo_rds.types.string.String"] = None,
    source_arn: Optional["capo_rds.types.string.String"] = None,
    s3_bucket_name: Optional["capo_rds.types.string.String"] = None,
    iam_role_arn: Optional["capo_rds.types.string.String"] = None,
    kms_key_id: Optional["capo_rds.types.string.String"] = None,
    s3_prefix: Optional["capo_rds.types.string.String"] = None,
    export_only: Optional["capo_rds.types.string_list.StringList"] = None,
) -> "capo_rds.types.export_task.ExportTask":
    """<p>Starts an export of DB snapshot or DB cluster data to Amazon S3. The provided IAM role must have access to the S3 bucket.</p> <p>You can't export snapshot data from RDS Custom DB instances. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RDS_Fea_Regions_DB-eng.Feature.ExportSnapshotToS3.html"> Supported Regions and DB engines for exporting snapshots to S3 in Amazon RDS</a>.</p> <p>For more information on exporting DB snapshot data, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ExportSnapshot.html">Exporting DB snapshot data to Amazon S3</a> in the <i>Amazon RDS User Guide</i> or <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-export-snapshot.html">Exporting DB cluster snapshot data to Amazon S3</a> in the <i>Amazon Aurora User Guide</i>.</p> <p>For more information on exporting DB cluster data, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/export-cluster-data.html">Exporting DB cluster data to Amazon S3</a> in the <i>Amazon Aurora User Guide</i>.</p>

    Args:
        export_task_identifier: <p>A unique identifier for the export task. This ID isn't an identifier for the Amazon S3 bucket where the data is to be exported.</p>
        source_arn: <p>The Amazon Resource Name (ARN) of the snapshot or cluster to export to Amazon S3.</p>
        s3_bucket_name: <p>The name of the Amazon S3 bucket to export the snapshot or cluster data to.</p>
        iam_role_arn: <p>The name of the IAM role to use for writing to the Amazon S3 bucket when exporting a snapshot or cluster.</p> <p>In the IAM policy attached to your IAM role, include the following required actions to allow the transfer of files from Amazon RDS or Amazon Aurora to an S3 bucket:</p> <ul> <li> <p>s3:PutObject*</p> </li> <li> <p>s3:GetObject*</p> </li> <li> <p>s3:ListBucket</p> </li> <li> <p>s3:DeleteObject*</p> </li> <li> <p>s3:GetBucketLocation </p> </li> </ul> <p>In the policy, include the resources to identify the S3 bucket and objects in the bucket. The following list of resources shows the Amazon Resource Name (ARN) format for accessing S3:</p> <ul> <li> <p> <code>arn:aws:s3:::<i>your-s3-bucket</i> </code> </p> </li> <li> <p> <code>arn:aws:s3:::<i>your-s3-bucket</i>/*</code> </p> </li> </ul>
        kms_key_id: <p>The ID of the Amazon Web Services KMS key to use to encrypt the data exported to Amazon S3. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. The caller of this operation must be authorized to run the following operations. These can be set in the Amazon Web Services KMS key policy:</p> <ul> <li> <p>kms:CreateGrant</p> </li> <li> <p>kms:DescribeKey</p> </li> </ul>
        s3_prefix: <p>The Amazon S3 bucket prefix to use as the file name and path of the exported data.</p>
        export_only: <p>The data to be exported from the snapshot or cluster. If this parameter isn't provided, all of the data is exported.</p> <p>Valid Values:</p> <ul> <li> <p> <code>database</code> - Export all the data from a specified database.</p> </li> <li> <p> <code>database.table</code> <i>table-name</i> - Export a table of the snapshot or cluster. This format is valid only for RDS for MySQL, RDS for MariaDB, and Aurora MySQL.</p> </li> <li> <p> <code>database.schema</code> <i>schema-name</i> - Export a database schema of the snapshot or cluster. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.</p> </li> <li> <p> <code>database.schema.table</code> <i>table-name</i> - Export a table of the database schema. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.</p> </li> </ul>

    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_cluster_snapshot_not_found_fault.DBClusterSnapshotNotFoundFault: <p> <code>DBClusterSnapshotIdentifier</code> doesn't refer to an existing DB cluster snapshot.</p>
        capo_rds.errors.db_snapshot_not_found_fault.DBSnapshotNotFoundFault: <p> <code>DBSnapshotIdentifier</code> doesn't refer to an existing DB snapshot.</p>
        capo_rds.errors.export_task_already_exists_fault.ExportTaskAlreadyExistsFault: <p>You can't start an export task that's already running.</p>
        capo_rds.errors.iam_role_missing_permissions_fault.IamRoleMissingPermissionsFault: <p>The IAM role requires additional permissions to export to an Amazon S3 bucket.</p>
        capo_rds.errors.iam_role_not_found_fault.IamRoleNotFoundFault: <p>The IAM role is missing for exporting to an Amazon S3 bucket.</p>
        capo_rds.errors.invalid_export_only_fault.InvalidExportOnlyFault: <p>The export is invalid for exporting to an Amazon S3 bucket.</p>
        capo_rds.errors.invalid_export_source_state_fault.InvalidExportSourceStateFault: <p>The state of the export snapshot is invalid for exporting to an Amazon S3 bucket.</p>
        capo_rds.errors.invalid_s3_bucket_fault.InvalidS3BucketFault: <p>The specified Amazon S3 bucket name can't be found or Amazon RDS isn't authorized to access the specified Amazon S3 bucket. Verify the <b>SourceS3BucketName</b> and <b>S3IngestionRoleArn</b> values and try again.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To export a snapshot to Amazon S3
        The following example exports a DB snapshot named db5-snapshot-test to the Amazon S3 bucket named mybucket.

        >>> await client.start_export_task(export_task_identifier='my-s3-export', source_arn='arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test', s3_bucket_name='mybucket', iam_role_arn='arn:aws:iam::123456789012:role/service-role/ExportRole', kms_key_id='arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.start_export_task_message.StartExportTaskMessage]",
    ) -> AsyncOperationResponse["capo_rds.types.export_task.ExportTask"]:
        import capo_rds._operations.amazon_rd_sv19.start_export_task

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartExportTask")
    )
    input_: capo_rds.types.start_export_task_message.StartExportTaskMessage = {}
    if export_task_identifier is not None:
        input_["export_task_identifier"] = export_task_identifier
    if source_arn is not None:
        input_["source_arn"] = source_arn
    if s3_bucket_name is not None:
        input_["s3_bucket_name"] = s3_bucket_name
    if iam_role_arn is not None:
        input_["iam_role_arn"] = iam_role_arn
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if s3_prefix is not None:
        input_["s3_prefix"] = s3_prefix
    if export_only is not None:
        input_["export_only"] = export_only

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