EC2 / Client / create_application_status_check

create_application_status_check

EC2.Client.create_application_status_check(**kwargs)

Creates an application status check for monitoring the health of applications running on your instances. You can configure the protocol, port, path, and thresholds for the health check. The following rules apply:

  • You can create a maximum of 50 application status checks per account.

  • Health checks do not start until you associate the check with instances or tags using AssociateApplicationStatusCheck.

  • The Timeout value must be less than the Interval value.

  • The Path must start with a forward slash ( /). Default: /.

  • If you do not specify Aggregation, it defaults to included, which means the check contributes to the instance-level application status.

  • Default values: Interval is 60 seconds, Timeout is 6 seconds, FailureThreshold is 2, SuccessThreshold is 5, StatusCodeMatcher is 200, InitializationGracePeriodSeconds is 300 seconds.

  • You can tag the application status check during creation. For more information, see Tag your Amazon EC2 resources.

See also: AWS API Documentation

Request Syntax

response = client.create_application_status_check(
    HealthCheckPaths=[
        {
            'Source': {
                'SubnetId': 'string',
                'SecurityGroupId': 'string'
            },
            'Destinations': [
                {
                    'SubnetId': 'string',
                    'SecurityGroupId': 'string'
                },
            ]
        },
    ],
    Aggregation='included'|'excluded',
    Protocol='http'|'https',
    Port=123,
    Path='string',
    DeviceIndex=123,
    IpVersion='ipv4'|'ipv6',
    IpScope='private',
    Interval=123,
    Timeout=123,
    FailureThreshold=123,
    SuccessThreshold=123,
    StatusCodeMatcher='string',
    InitializationGracePeriodSeconds=123,
    TagSpecifications=[
        {
            'ResourceType': 'capacity-reservation'|'client-vpn-endpoint'|'customer-gateway'|'carrier-gateway'|'coip-pool'|'declarative-policies-report'|'dedicated-host'|'dhcp-options'|'egress-only-internet-gateway'|'elastic-ip'|'elastic-gpu'|'export-image-task'|'export-instance-task'|'fleet'|'fpga-image'|'host-reservation'|'image'|'image-usage-report'|'import-image-task'|'import-snapshot-task'|'instance'|'instance-event-window'|'internet-gateway'|'ipam'|'ipam-pool'|'ipam-scope'|'ipv4pool-ec2'|'ipv6pool-ec2'|'key-pair'|'launch-template'|'local-gateway'|'local-gateway-route-table'|'local-gateway-virtual-interface'|'local-gateway-virtual-interface-group'|'local-gateway-route-table-vpc-association'|'local-gateway-route-table-virtual-interface-group-association'|'natgateway'|'network-acl'|'network-interface'|'network-insights-analysis'|'network-insights-path'|'network-insights-access-scope'|'network-insights-access-scope-analysis'|'outpost-lag'|'placement-group'|'prefix-list'|'replace-root-volume-task'|'reserved-instances'|'route-table'|'security-group'|'security-group-rule'|'service-link-virtual-interface'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'subnet-cidr-reservation'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-connect-peer'|'transit-gateway-multicast-domain'|'transit-gateway-policy-table'|'transit-gateway-metering-policy'|'transit-gateway-route-table'|'transit-gateway-route-table-announcement'|'volume'|'vpc'|'vpc-endpoint'|'vpc-endpoint-connection'|'vpc-endpoint-service'|'vpc-endpoint-service-permission'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log'|'capacity-reservation-fleet'|'traffic-mirror-filter-rule'|'vpc-endpoint-connection-device-type'|'verified-access-instance'|'verified-access-group'|'verified-access-endpoint'|'verified-access-policy'|'verified-access-trust-provider'|'vpn-connection-device-type'|'vpc-block-public-access-exclusion'|'vpc-encryption-control'|'route-server'|'route-server-endpoint'|'route-server-peer'|'ipam-resource-discovery'|'ipam-resource-discovery-association'|'instance-connect-endpoint'|'verified-access-endpoint-target'|'ipam-external-resource-verification-token'|'capacity-block'|'mac-modification-task'|'ipam-prefix-list-resolver'|'ipam-policy'|'ipam-prefix-list-resolver-target'|'secondary-interface'|'secondary-network'|'secondary-subnet'|'capacity-manager-data-export'|'vpn-concentrator'|'ipam-pool-allocation'|'capacity-reservation-cancellation-quote'|'application-status-check',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    ClientToken='string',
    DryRun=True|False
)
Parameters:
  • HealthCheckPaths (list) –

    The health check paths to use for the application status check. Health check paths define the network path from a source subnet to one or more destination subnets for cross-Availability Zone or Availability Zone to Local Zone health checking. If omitted, health checks are performed in the same subnet as the instance.

    • (dict) –

      Describes a health check path for an application status check request.

      • Source (dict) –

        The source for the health check path.

        • SubnetId (string) –

          The ID of the subnet for the source.

        • SecurityGroupId (string) –

          The ID of the security group for the source.

      • Destinations (list) –

        The destinations for the health check path.

        • (dict) –

          Describes a destination for a health check path in a request. Destinations can be in a different Availability Zone than the source (cross-AZ) or in a Local Zone (AZ to Local Zone), enabling remote health validation of your application.

          • SubnetId (string) –

            The ID of the subnet for the destination.

          • SecurityGroupId (string) –

            The ID of the security group for the destination.

  • Aggregation (string) – The aggregation setting for the application status check. When set to included, the result of this check contributes to the instance-level application status reported by DescribeApplicationStatus. When set to excluded, the check runs independently and does not affect the instance-level status. Valid values: included | excluded.

  • Protocol (string) –

    [REQUIRED]

    The protocol to use for the health check. Valid values: http | https.

  • Port (integer) –

    [REQUIRED]

    The port to use for the health check. Valid values: 1 to 65535.

  • Path (string) – The URL path to use for the health check HTTP request (for example, /health or /status).

  • DeviceIndex (integer) – The index of the network device to use for the health check. The value must be greater than or equal to 0.

  • IpVersion (string) – The IP version to use for the health check. Valid values: ipv4 and ipv6.

  • IpScope (string) – The IP scope to use for the health check. Valid value: private.

  • Interval (integer) – The interval, in seconds, between health checks. Valid value: 60.

  • Timeout (integer) – The amount of time, in seconds, to wait for a health check response before considering it failed. Valid values: 1 to 30. The value must be less than Interval.

  • FailureThreshold (integer) – The number of consecutive failed health checks before the application status is considered impaired. The value must be greater than 0.

  • SuccessThreshold (integer) – The number of consecutive successful health checks before the application status is considered healthy. The value must be greater than 0.

  • StatusCodeMatcher (string) – The HTTP status codes that indicate a successful health check response. Specify a comma-separated list of individual status codes or ranges, for example, 200,202,300-399. For a range, the first value must be less than the second value. Maximum length: 64 characters. Default: 200.

  • InitializationGracePeriodSeconds (integer) – The number of seconds to wait before starting health checks after an instance is launched. Valid values: 1 to 600.

  • TagSpecifications (list) –

    The tags to apply to the application status check.

    • (dict) –

      The tags to apply to a resource when the resource is being created. When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.

      Note

      The Valid Values lists all the resource types that can be tagged. However, the action you’re using might not support tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you’re using, you’ll get an error.

      • ResourceType (string) –

        The type of resource to tag on creation.

      • Tags (list) –

        The tags to apply to the resource.

        • (dict) –

          Describes a tag.

          • Key (string) –

            The key of the tag.

            Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

          • Value (string) –

            The value of the tag.

            Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

  • ClientToken (string) –

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

    This field is autopopulated if not provided.

  • DryRun (boolean) – 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.

Return type:

dict

Returns:

Response Syntax

{
    'ApplicationStatusCheck': {
        'ApplicationStatusCheckId': 'string',
        'Aggregation': 'included'|'excluded',
        'HealthCheckPaths': [
            {
                'Source': {
                    'SubnetId': 'string',
                    'SecurityGroupId': 'string'
                },
                'Destinations': [
                    {
                        'SubnetId': 'string',
                        'SecurityGroupId': 'string'
                    },
                ]
            },
        ],
        'Protocol': 'http'|'https',
        'Port': 123,
        'Path': 'string',
        'DeviceIndex': 123,
        'IpVersion': 'ipv4'|'ipv6',
        'IpScope': 'private',
        'Interval': 123,
        'Timeout': 123,
        'FailureThreshold': 123,
        'SuccessThreshold': 123,
        'StatusCodeMatcher': 'string',
        'InitializationGracePeriodSeconds': 123,
        'LastUpdatedAt': datetime(2015, 1, 1),
        'TargetTagAssociations': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'Tags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'CreationTime': datetime(2015, 1, 1),
        'ModifyTime': datetime(2015, 1, 1),
        'DeletionTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) –

    • ApplicationStatusCheck (dict) –

      Information about the application status check.

      • ApplicationStatusCheckId (string) –

        The ID of the application status check.

      • Aggregation (string) –

        The aggregation setting for the application status check. When set to included, the result of this check contributes to the instance-level application status. When set to excluded, the check runs independently and does not affect the instance-level status.

      • HealthCheckPaths (list) –

        The health check paths for the application status check.

        • (dict) –

          Describes a health check path for an application status check.

          • Source (dict) –

            The source for the health check path.

            • SubnetId (string) –

              The ID of the subnet for the source.

            • SecurityGroupId (string) –

              The ID of the security group for the source.

          • Destinations (list) –

            The destinations for the health check path.

            • (dict) –

              Describes a destination for a health check path.

              • SubnetId (string) –

                The ID of the subnet for the destination.

              • SecurityGroupId (string) –

                The ID of the security group for the destination.

      • Protocol (string) –

        The protocol used for the health check.

      • Port (integer) –

        The port used for the health check.

      • Path (string) –

        The URL path used for the health check HTTP request.

      • DeviceIndex (integer) –

        The index of the network device used for the health check. The value is greater than or equal to 0.

      • IpVersion (string) –

        The IP version used for the health check.

      • IpScope (string) –

        The IP scope used for the health check.

      • Interval (integer) –

        The interval, in seconds, between health checks. Valid value: 60.

      • Timeout (integer) –

        The amount of time, in seconds, to wait for a health check response. Valid values: 1 to 30.

      • FailureThreshold (integer) –

        The number of consecutive failed health checks before the application status is considered impaired. The value must be greater than 0.

      • SuccessThreshold (integer) –

        The number of consecutive successful health checks before the application status is considered healthy. The value must be greater than 0.

      • StatusCodeMatcher (string) –

        The comma-separated list of individual HTTP status codes or ranges that indicate a successful health check response.

      • InitializationGracePeriodSeconds (integer) –

        The number of seconds to wait before starting health checks after an instance is launched. Valid values: 1 to 600.

      • LastUpdatedAt (datetime) –

        The date and time when the application status check was last updated.

      • TargetTagAssociations (list) –

        The tags associated with the application status check. Instances with these tags are automatically monitored by this check.

        • (dict) –

          Describes a tag key-value pair for an application status check association.

          • Key (string) –

            The key of the tag.

          • Value (string) –

            The value of the tag.

      • Tags (list) –

        The tags assigned to the application status check.

        • (dict) –

          Describes a tag.

          • Key (string) –

            The key of the tag.

            Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

          • Value (string) –

            The value of the tag.

            Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

      • CreationTime (datetime) –

        The date and time when the application status check was created.

      • ModifyTime (datetime) –

        The date and time when the application status check was last modified.

      • DeletionTime (datetime) –

        The date and time when the application status check was deleted.