Skip to content

create_capacity_manager_data_export async

create_capacity_manager_data_export(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    s3_bucket_name: Optional[String] = None,
    s3_bucket_prefix: Optional[String] = None,
    schedule: Optional[Schedule] = None,
    output_format: Optional[OutputFormat] = None,
    client_token: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
) -> CreateCapacityManagerDataExportResult

Creates a new data export configuration for EC2 Capacity Manager. This allows you to automatically export capacity usage data to an S3 bucket on a scheduled basis. The exported data includes metrics for On-Demand, Spot, and Capacity Reservations usage across your organization.

Parameters:

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

    The name of the S3 bucket where the capacity data export files will be delivered. The bucket must exist and you must have write permissions to it.

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

    The S3 key prefix for the exported data files. This allows you to organize exports in a specific folder structure within your bucket. If not specified, files are placed at the bucket root.

  • schedule (Optional[Schedule], default: None ) –

    The frequency at which data exports are generated.

  • output_format (Optional[OutputFormat], default: None ) –

    The file format for the exported data. Parquet format is recommended for large datasets and better compression.

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

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.

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

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • tag_specifications (Optional[TagSpecificationList], default: None ) –

    The tags to apply to the data export configuration. You can tag the export for organization and cost tracking purposes.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_capacity_manager_data_export(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    s3_bucket_name: Optional["capo_ec2.types.string.String"] = None,
    s3_bucket_prefix: Optional["capo_ec2.types.string.String"] = None,
    schedule: Optional["capo_ec2.types.schedule.Schedule"] = None,
    output_format: Optional["capo_ec2.types.output_format.OutputFormat"] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
) -> "capo_ec2.types.create_capacity_manager_data_export_result.CreateCapacityManagerDataExportResult":
    """<p> Creates a new data export configuration for EC2 Capacity Manager. This allows you to automatically export capacity usage data to an S3 bucket on a scheduled basis. The exported data includes metrics for On-Demand, Spot, and Capacity Reservations usage across your organization. </p>

    Args:
        s3_bucket_name: <p> The name of the S3 bucket where the capacity data export files will be delivered. The bucket must exist and you must have write permissions to it. </p>
        s3_bucket_prefix: <p> The S3 key prefix for the exported data files. This allows you to organize exports in a specific folder structure within your bucket. If not specified, files are placed at the bucket root. </p>
        schedule: <p> The frequency at which data exports are generated. </p>
        output_format: <p> The file format for the exported data. Parquet format is recommended for large datasets and better compression. </p>
        client_token: <p> Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency. </p>
        dry_run: <p> Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>. </p>
        tag_specifications: <p> The tags to apply to the data export configuration. You can tag the export for organization and cost tracking purposes. </p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_capacity_manager_data_export_request.CreateCapacityManagerDataExportRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_capacity_manager_data_export_result.CreateCapacityManagerDataExportResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_capacity_manager_data_export

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.create_capacity_manager_data_export.async_create_capacity_manager_data_export(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCapacityManagerDataExport")
    )
    input_: capo_ec2.types.create_capacity_manager_data_export_request.CreateCapacityManagerDataExportRequest = {}
    if s3_bucket_name is not None:
        input_["s3_bucket_name"] = s3_bucket_name
    if s3_bucket_prefix is not None:
        input_["s3_bucket_prefix"] = s3_bucket_prefix
    if schedule is not None:
        input_["schedule"] = schedule
    if output_format is not None:
        input_["output_format"] = output_format
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications

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