Skip to content

create_health_check async

create_health_check(
    caller_reference: HealthCheckNonce,
    health_check_config: HealthCheckConfig,
    *,
    config_overrides: Optional[AsyncRoute53ClientConfig] = None,
) -> CreateHealthCheckResponse

Creates a new health check.

For information about adding health checks to resource record sets, see HealthCheckId in ChangeResourceRecordSets.

ELB Load Balancers

If you're registering EC2 instances with an Elastic Load Balancing (ELB) load balancer, do not create Amazon Route 53 health checks for the EC2 instances. When you register an EC2 instance with a load balancer, you configure settings for an ELB health check, which performs a similar function to a Route 53 health check.

Private Hosted Zones

You can associate health checks with failover resource record sets in a private hosted zone. Note the following:

  • Route 53 health checkers are outside the VPC. To check the health of an endpoint within a VPC by IP address, you must assign a public IP address to the instance in the VPC.

  • You can configure a health checker to check the health of an external resource that the instance relies on, such as a database server.

  • You can create a CloudWatch metric, associate an alarm with the metric, and then create a health check that is based on the state of the alarm. For example, you might create a CloudWatch metric that checks the status of the Amazon EC2 StatusCheckFailed metric, add an alarm to the metric, and then create a health check that is based on the state of the alarm. For information about creating CloudWatch metrics and alarms by using the CloudWatch console, see the Amazon CloudWatch User Guide.

Parameters:

  • caller_reference (HealthCheckNonce) –

    A unique string that identifies the request and that allows you to retry a failed CreateHealthCheck request without the risk of creating two identical health checks:

    • If you send a CreateHealthCheck request with the same CallerReference and settings as a previous request, and if the health check doesn't exist, Amazon Route 53 creates the health check. If the health check does exist, Route 53 returns the health check configuration in the response.

    • If you send a CreateHealthCheck request with the same CallerReference as a deleted health check, regardless of the settings, Route 53 returns a HealthCheckAlreadyExists error.

    • If you send a CreateHealthCheck request with the same CallerReference as an existing health check but with different settings, Route 53 returns a HealthCheckAlreadyExists error.

    • If you send a CreateHealthCheck request with a unique CallerReference but settings identical to an existing health check, Route 53 creates the health check.

    Route 53 does not store the CallerReference for a deleted health check indefinitely. The CallerReference for a deleted health check will be deleted after a number of days.

  • health_check_config (HealthCheckConfig) –

    A complex type that contains settings for a new health check.

Raises:

  • HealthCheckAlreadyExists –

    The health check you're attempting to create already exists. Amazon Route 53 returns this error when you submit a request that has the following values:

    • The same value for CallerReference as an existing health check, and one or more values that differ from the existing health check that has the same caller reference.

    • The same value for CallerReference as a health check that you created and later deleted, regardless of the other settings in the request.

  • InvalidInput –

    The input is not valid.

  • TooManyHealthChecks –

    This health check can't be created because the current account has reached the limit on the number of active health checks.

    For information about default limits, see Limits in the Amazon Route 53 Developer Guide.

    For information about how to get the current limit for an account, see GetAccountLimit. To request a higher limit, create a case with the Amazon Web Services Support Center.

    You have reached the maximum number of active health checks for an Amazon Web Services account. To request a higher limit, create a case with the Amazon Web Services Support Center.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_route_53/_services/async_route53.py
async def create_health_check(
    self,
    caller_reference: "capo_route_53.types.health_check_nonce.HealthCheckNonce",
    health_check_config: "capo_route_53.types.health_check_config.HealthCheckConfig",
    *,
    config_overrides: Optional[AsyncRoute53ClientConfig] = None,
) -> "capo_route_53.types.create_health_check_response.CreateHealthCheckResponse":
    """<p>Creates a new health check.</p> <p>For information about adding health checks to resource record sets, see <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_ResourceRecordSet.html#Route53-Type-ResourceRecordSet-HealthCheckId">HealthCheckId</a> in <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html">ChangeResourceRecordSets</a>. </p> <p> <b>ELB Load Balancers</b> </p> <p>If you're registering EC2 instances with an Elastic Load Balancing (ELB) load balancer, do not create Amazon Route 53 health checks for the EC2 instances. When you register an EC2 instance with a load balancer, you configure settings for an ELB health check, which performs a similar function to a Route 53 health check.</p> <p> <b>Private Hosted Zones</b> </p> <p>You can associate health checks with failover resource record sets in a private hosted zone. Note the following:</p> <ul> <li> <p>Route 53 health checkers are outside the VPC. To check the health of an endpoint within a VPC by IP address, you must assign a public IP address to the instance in the VPC.</p> </li> <li> <p>You can configure a health checker to check the health of an external resource that the instance relies on, such as a database server.</p> </li> <li> <p>You can create a CloudWatch metric, associate an alarm with the metric, and then create a health check that is based on the state of the alarm. For example, you might create a CloudWatch metric that checks the status of the Amazon EC2 <code>StatusCheckFailed</code> metric, add an alarm to the metric, and then create a health check that is based on the state of the alarm. For information about creating CloudWatch metrics and alarms by using the CloudWatch console, see the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>.</p> </li> </ul>

    Args:
        caller_reference: <p>A unique string that identifies the request and that allows you to retry a failed <code>CreateHealthCheck</code> request without the risk of creating two identical health checks:</p> <ul> <li> <p>If you send a <code>CreateHealthCheck</code> request with the same <code>CallerReference</code> and settings as a previous request, and if the health check doesn't exist, Amazon Route 53 creates the health check. If the health check does exist, Route 53 returns the health check configuration in the response. </p> </li> <li> <p>If you send a <code>CreateHealthCheck</code> request with the same <code>CallerReference</code> as a deleted health check, regardless of the settings, Route 53 returns a <code>HealthCheckAlreadyExists</code> error.</p> </li> <li> <p>If you send a <code>CreateHealthCheck</code> request with the same <code>CallerReference</code> as an existing health check but with different settings, Route 53 returns a <code>HealthCheckAlreadyExists</code> error.</p> </li> <li> <p>If you send a <code>CreateHealthCheck</code> request with a unique <code>CallerReference</code> but settings identical to an existing health check, Route 53 creates the health check.</p> </li> </ul> <p> Route 53 does not store the <code>CallerReference</code> for a deleted health check indefinitely. The <code>CallerReference</code> for a deleted health check will be deleted after a number of days.</p>
        health_check_config: <p>A complex type that contains settings for a new health check.</p>

    Raises:
        capo_route_53.errors.health_check_already_exists.HealthCheckAlreadyExists: <p> The health check you're attempting to create already exists. Amazon Route 53 returns this error when you submit a request that has the following values:</p> <ul> <li> <p>The same value for <code>CallerReference</code> as an existing health check, and one or more values that differ from the existing health check that has the same caller reference.</p> </li> <li> <p>The same value for <code>CallerReference</code> as a health check that you created and later deleted, regardless of the other settings in the request.</p> </li> </ul>
        capo_route_53.errors.invalid_input.InvalidInput: <p>The input is not valid.</p>
        capo_route_53.errors.too_many_health_checks.TooManyHealthChecks: <p>This health check can't be created because the current account has reached the limit on the number of active health checks.</p> <p>For information about default limits, see <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html">Limits</a> in the <i>Amazon Route 53 Developer Guide</i>.</p> <p>For information about how to get the current limit for an account, see <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html">GetAccountLimit</a>. To request a higher limit, <a href="http://aws.amazon.com/route53-request">create a case</a> with the Amazon Web Services Support Center.</p> <p>You have reached the maximum number of active health checks for an Amazon Web Services account. To request a higher limit, <a href="http://aws.amazon.com/route53-request">create a case</a> with the Amazon Web Services Support Center.</p>
        capo_route_53.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_route_53.types.create_health_check_request.CreateHealthCheckRequest]",
    ) -> AsyncOperationResponse[
        "capo_route_53.types.create_health_check_response.CreateHealthCheckResponse"
    ]:
        import capo_route_53._operations.aws_dns_v20130401.create_health_check

        (
            output,
            http_response,
        ) = await capo_route_53._operations.aws_dns_v20130401.create_health_check.async_create_health_check(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateHealthCheck")
    )
    input_: capo_route_53.types.create_health_check_request.CreateHealthCheckRequest = {
        "caller_reference": caller_reference,
        "health_check_config": health_check_config,
    }

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