Skip to content

modify_default_credit_specification

modify_default_credit_specification(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    instance_family: Optional[UnlimitedSupportedInstanceFamily] = None,
    cpu_credits: Optional[String] = None,
) -> ModifyDefaultCreditSpecificationResult

Modifies the default credit option for CPU usage of burstable performance instances. The default credit option is set at the account level per Amazon Web Services Region, and is specified per instance family. All new burstable performance instances in the account launch using the default credit option.

ModifyDefaultCreditSpecification is an asynchronous operation, which works at an Amazon Web Services Region level and modifies the credit option for each Availability Zone. All zones in a Region are updated within five minutes. But if instances are launched during this operation, they might not get the new credit option until the zone is updated. To verify whether the update has occurred, you can call GetDefaultCreditSpecification and check DefaultCreditSpecification for updates.

For more information, see Burstable performance instances in the Amazon EC2 User Guide.

Parameters:

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

    Checks whether you have the required permissions for the operation, 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.

  • instance_family (Optional[UnlimitedSupportedInstanceFamily], default: None ) –

    The instance family.

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

    The credit option for CPU usage of the instance family.

    Valid Values: standard | unlimited

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def modify_default_credit_specification(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    instance_family: Optional[
        "capo_ec2.types.unlimited_supported_instance_family.UnlimitedSupportedInstanceFamily"
    ] = None,
    cpu_credits: Optional["capo_ec2.types.string.String"] = None,
) -> "capo_ec2.types.modify_default_credit_specification_result.ModifyDefaultCreditSpecificationResult":
    """<p>Modifies the default credit option for CPU usage of burstable performance instances. The default credit option is set at the account level per Amazon Web Services Region, and is specified per instance family. All new burstable performance instances in the account launch using the default credit option.</p> <p> <code>ModifyDefaultCreditSpecification</code> is an asynchronous operation, which works at an Amazon Web Services Region level and modifies the credit option for each Availability Zone. All zones in a Region are updated within five minutes. But if instances are launched during this operation, they might not get the new credit option until the zone is updated. To verify whether the update has occurred, you can call <code>GetDefaultCreditSpecification</code> and check <code>DefaultCreditSpecification</code> for updates.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html">Burstable performance instances</a> in the <i>Amazon EC2 User Guide</i>.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the operation, 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>
        instance_family: <p>The instance family.</p>
        cpu_credits: <p>The credit option for CPU usage of the instance family.</p> <p>Valid Values: <code>standard</code> | <code>unlimited</code> </p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.modify_default_credit_specification_request.ModifyDefaultCreditSpecificationRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.modify_default_credit_specification_result.ModifyDefaultCreditSpecificationResult"
    ]:
        import capo_ec2._operations.amazon_ec2.modify_default_credit_specification

        output, http_response = (
            capo_ec2._operations.amazon_ec2.modify_default_credit_specification.modify_default_credit_specification(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyDefaultCreditSpecification")
    )
    input_: capo_ec2.types.modify_default_credit_specification_request.ModifyDefaultCreditSpecificationRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if instance_family is not None:
        input_["instance_family"] = instance_family
    if cpu_credits is not None:
        input_["cpu_credits"] = cpu_credits

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