CfnService
- class aws_cdk.aws_servicediscovery.CfnService(scope, id, *, description=None, dns_config=None, health_check_config=None, health_check_custom_config=None, name=None, namespace_id=None, tags=None, type=None)
Bases:
CfnResource
A complex type that contains information about a service, which defines the configuration of the following entities:.
For public and private DNS namespaces, one of the following combinations of DNS records in Amazon Route 53:
A
AAAA
A and AAAA
SRV
CNAME
Optionally, a health check
- See:
- CloudformationResource:
AWS::ServiceDiscovery::Service
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_servicediscovery as servicediscovery cfn_service = servicediscovery.CfnService(self, "MyCfnService", description="description", dns_config=servicediscovery.CfnService.DnsConfigProperty( dns_records=[servicediscovery.CfnService.DnsRecordProperty( ttl=123, type="type" )], # the properties below are optional namespace_id="namespaceId", routing_policy="routingPolicy" ), health_check_config=servicediscovery.CfnService.HealthCheckConfigProperty( type="type", # the properties below are optional failure_threshold=123, resource_path="resourcePath" ), health_check_custom_config=servicediscovery.CfnService.HealthCheckCustomConfigProperty( failure_threshold=123 ), name="name", namespace_id="namespaceId", tags=[CfnTag( key="key", value="value" )], type="type" )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).description (
Optional
[str
]) – The description of the service.dns_config (
Union
[IResolvable
,DnsConfigProperty
,Dict
[str
,Any
],None
]) – A complex type that contains information about the Route 53 DNS records that you want AWS Cloud Map to create when you register an instance. .. epigraph:: The record types of a service can only be changed by deleting the service and recreating it with a newDnsconfig
.health_check_config (
Union
[IResolvable
,HealthCheckConfigProperty
,Dict
[str
,Any
],None
]) – Public DNS and HTTP namespaces only. A complex type that contains settings for an optional health check. If you specify settings for a health check, AWS Cloud Map associates the health check with the records that you specify inDnsConfig
. For information about the charges for health checks, see Amazon Route 53 Pricing .health_check_custom_config (
Union
[IResolvable
,HealthCheckCustomConfigProperty
,Dict
[str
,Any
],None
]) – A complex type that contains information about an optional custom health check. .. epigraph:: If you specify a health check configuration, you can specify eitherHealthCheckCustomConfig
orHealthCheckConfig
but not both.name (
Optional
[str
]) – The name of the service.namespace_id (
Optional
[str
]) – The ID of the namespace that was used to create the service. .. epigraph:: You must specify a value forNamespaceId
either for the service properties or for DnsConfig . Don’t specify a value in both places.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – The tags for the service. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.type (
Optional
[str
]) – If present, specifies that the service instances are only discoverable using theDiscoverInstances
API operation. No DNS records is registered for the service instances. The only valid value isHTTP
.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::ServiceDiscovery::Service'
- attr_arn
The Amazon Resource Name (ARN) of the service.
- CloudformationAttribute:
Arn
- attr_id
The ID of the service.
- CloudformationAttribute:
Id
- attr_name
The name that you assigned to the service.
- CloudformationAttribute:
Name
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- description
The description of the service.
- dns_config
A complex type that contains information about the Route 53 DNS records that you want AWS Cloud Map to create when you register an instance.
- health_check_config
Public DNS and HTTP namespaces only. A complex type that contains settings for an optional health check. If you specify settings for a health check, AWS Cloud Map associates the health check with the records that you specify in
DnsConfig
.
- health_check_custom_config
A complex type that contains information about an optional custom health check.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- name
The name of the service.
- namespace_id
The ID of the namespace that was used to create the service.
- node
The tree node.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Tag Manager which manages the tags for this resource.
- tags_raw
The tags for the service.
- type
If present, specifies that the service instances are only discoverable using the
DiscoverInstances
API operation.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
DnsConfigProperty
- class CfnService.DnsConfigProperty(*, dns_records, namespace_id=None, routing_policy=None)
Bases:
object
A complex type that contains information about the Amazon Route 53 DNS records that you want AWS Cloud Map to create when you register an instance.
- Parameters:
dns_records (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,DnsRecordProperty
,Dict
[str
,Any
]]]]) – An array that contains oneDnsRecord
object for each Route 53 DNS record that you want AWS Cloud Map to create when you register an instance. .. epigraph:: The record type of a service can’t be updated directly and can only be changed by deleting the service and recreating it with a newDnsConfig
.namespace_id (
Optional
[str
]) – The ID of the namespace to use for DNS configuration. .. epigraph:: You must specify a value forNamespaceId
either forDnsConfig
or for the service properties . Don’t specify a value in both places.routing_policy (
Optional
[str
]) – The routing policy that you want to apply to all Route 53 DNS records that AWS Cloud Map creates when you register an instance and specify this service. .. epigraph:: If you want to use this service to register instances that create alias records, specifyWEIGHTED
for the routing policy. You can specify the following values: - MULTIVALUE - If you define a health check for the service and the health check is healthy, Route 53 returns the applicable value for up to eight instances. For example, suppose that the service includes configurations for oneA
record and a health check. You use the service to register 10 instances. Route 53 responds to DNS queries with IP addresses for up to eight healthy instances. If fewer than eight instances are healthy, Route 53 responds to every DNS query with the IP addresses for all of the healthy instances. If you don’t define a health check for the service, Route 53 assumes that all instances are healthy and returns the values for up to eight instances. For more information about the multivalue routing policy, see Multivalue Answer Routing in the Route 53 Developer Guide . - WEIGHTED - Route 53 returns the applicable value from one randomly selected instance from among the instances that you registered using the same service. Currently, all records have the same weight, so you can’t route more or less traffic to any instances. For example, suppose that the service includes configurations for oneA
record and a health check. You use the service to register 10 instances. Route 53 responds to DNS queries with the IP address for one randomly selected instance from among the healthy instances. If no instances are healthy, Route 53 responds to DNS queries as if all of the instances were healthy. If you don’t define a health check for the service, Route 53 assumes that all instances are healthy and returns the applicable value for one randomly selected instance. For more information about the weighted routing policy, see Weighted Routing in the Route 53 Developer Guide .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_servicediscovery as servicediscovery dns_config_property = servicediscovery.CfnService.DnsConfigProperty( dns_records=[servicediscovery.CfnService.DnsRecordProperty( ttl=123, type="type" )], # the properties below are optional namespace_id="namespaceId", routing_policy="routingPolicy" )
Attributes
- dns_records
An array that contains one
DnsRecord
object for each Route 53 DNS record that you want AWS Cloud Map to create when you register an instance.The record type of a service can’t be updated directly and can only be changed by deleting the service and recreating it with a new
DnsConfig
.
- namespace_id
The ID of the namespace to use for DNS configuration.
You must specify a value for
NamespaceId
either forDnsConfig
or for the service properties . Don’t specify a value in both places.
- routing_policy
The routing policy that you want to apply to all Route 53 DNS records that AWS Cloud Map creates when you register an instance and specify this service.
If you want to use this service to register instances that create alias records, specify
WEIGHTED
for the routing policy.You can specify the following values:
MULTIVALUE - If you define a health check for the service and the health check is healthy, Route 53 returns the applicable value for up to eight instances.
For example, suppose that the service includes configurations for one
A
record and a health check. You use the service to register 10 instances. Route 53 responds to DNS queries with IP addresses for up to eight healthy instances. If fewer than eight instances are healthy, Route 53 responds to every DNS query with the IP addresses for all of the healthy instances.If you don’t define a health check for the service, Route 53 assumes that all instances are healthy and returns the values for up to eight instances.
For more information about the multivalue routing policy, see Multivalue Answer Routing in the Route 53 Developer Guide .
WEIGHTED - Route 53 returns the applicable value from one randomly selected instance from among the instances that you registered using the same service. Currently, all records have the same weight, so you can’t route more or less traffic to any instances.
For example, suppose that the service includes configurations for one
A
record and a health check. You use the service to register 10 instances. Route 53 responds to DNS queries with the IP address for one randomly selected instance from among the healthy instances. If no instances are healthy, Route 53 responds to DNS queries as if all of the instances were healthy.If you don’t define a health check for the service, Route 53 assumes that all instances are healthy and returns the applicable value for one randomly selected instance.
For more information about the weighted routing policy, see Weighted Routing in the Route 53 Developer Guide .
DnsRecordProperty
- class CfnService.DnsRecordProperty(*, ttl, type)
Bases:
object
A complex type that contains information about the Route 53 DNS records that you want AWS Cloud Map to create when you register an instance.
- Parameters:
ttl (
Union
[int
,float
]) – The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record. .. epigraph:: Alias records don’t include a TTL because Route 53 uses the TTL for the AWS resource that an alias record routes traffic to. If you include theAWS_ALIAS_DNS_NAME
attribute when you submit a RegisterInstance request, theTTL
value is ignored. Always specify a TTL for the service; you can use a service to register instances that create either alias or non-alias records.type (
str
) –The type of the resource, which indicates the type of value that Route 53 returns in response to DNS queries. You can specify values for
Type
in the following combinations: -A
-AAAA
-A
andAAAA
-SRV
-CNAME
If you want AWS Cloud Map to create a Route 53 alias record when you register an instance, specifyA
orAAAA
forType
. You specify other settings, such as the IP address forA
andAAAA
records, when you register an instance. For more information, see RegisterInstance . The following values are supported: - A - Route 53 returns the IP address of the resource in IPv4 format, such as 192.0.2.44. - AAAA - Route 53 returns the IP address of the resource in IPv6 format, such as 2001:0db8:85a3:0000:0000:abcd:0001:2345. - CNAME - Route 53 returns the domain name of the resource, such as www.example.com. Note the following: - You specify the domain name that you want to route traffic to when you register an instance. For more information, see Attributes in the topic RegisterInstance . - You must specifyWEIGHTED
for the value ofRoutingPolicy
. - You can’t specify bothCNAME
forType
and settings forHealthCheckConfig
. If you do, the request will fail with anInvalidInput
error. - SRV - Route 53 returns the value for anSRV
record. The value for anSRV
record uses the following values:priority weight port service-hostname
Note the following about the values: - The values ofpriority
andweight
are both set to1
and can’t be changed. - The value ofport
comes from the value that you specify for theAWS_INSTANCE_PORT
attribute when you submit a RegisterInstance request. - The value ofservice-hostname
is a concatenation of the following values: - The value that you specify forInstanceId
when you register an instance. - The name of the service. - The name of the namespace. For example, if the value ofInstanceId
istest
, the name of the service isbackend
, and the name of the namespace isexample.com
, the value ofservice-hostname
is:test.backend.example.com
If you specify settings for anSRV
record and if you specify values forAWS_INSTANCE_IPV4
,AWS_INSTANCE_IPV6
, or both in theRegisterInstance
request, AWS Cloud Map automatically createsA
and/orAAAA
records that have the same name as the value ofservice-hostname
in theSRV
record. You can ignore these records.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_servicediscovery as servicediscovery dns_record_property = servicediscovery.CfnService.DnsRecordProperty( ttl=123, type="type" )
Attributes
- ttl
The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.
Alias records don’t include a TTL because Route 53 uses the TTL for the AWS resource that an alias record routes traffic to. If you include the
AWS_ALIAS_DNS_NAME
attribute when you submit a RegisterInstance request, theTTL
value is ignored. Always specify a TTL for the service; you can use a service to register instances that create either alias or non-alias records.
- type
The type of the resource, which indicates the type of value that Route 53 returns in response to DNS queries.
You can specify values for
Type
in the following combinations:A
AAAA
A
andAAAA
SRV
CNAME
If you want AWS Cloud Map to create a Route 53 alias record when you register an instance, specify
A
orAAAA
forType
.You specify other settings, such as the IP address for
A
andAAAA
records, when you register an instance. For more information, see RegisterInstance .The following values are supported:
A - Route 53 returns the IP address of the resource in IPv4 format, such as 192.0.2.44.
AAAA - Route 53 returns the IP address of the resource in IPv6 format, such as 2001:0db8:85a3:0000:0000:abcd:0001:2345.
CNAME - Route 53 returns the domain name of the resource, such as www.example.com. Note the following:
You specify the domain name that you want to route traffic to when you register an instance. For more information, see Attributes in the topic RegisterInstance .
You must specify
WEIGHTED
for the value ofRoutingPolicy
.You can’t specify both
CNAME
forType
and settings forHealthCheckConfig
. If you do, the request will fail with anInvalidInput
error.SRV - Route 53 returns the value for an
SRV
record. The value for anSRV
record uses the following values:
priority weight port service-hostname
Note the following about the values:
The values of
priority
andweight
are both set to1
and can’t be changed.The value of
port
comes from the value that you specify for theAWS_INSTANCE_PORT
attribute when you submit a RegisterInstance request.The value of
service-hostname
is a concatenation of the following values:The value that you specify for
InstanceId
when you register an instance.The name of the service.
The name of the namespace.
For example, if the value of
InstanceId
istest
, the name of the service isbackend
, and the name of the namespace isexample.com
, the value ofservice-hostname
is:test.backend.example.com
If you specify settings for an
SRV
record and if you specify values forAWS_INSTANCE_IPV4
,AWS_INSTANCE_IPV6
, or both in theRegisterInstance
request, AWS Cloud Map automatically createsA
and/orAAAA
records that have the same name as the value ofservice-hostname
in theSRV
record. You can ignore these records.
HealthCheckConfigProperty
- class CfnService.HealthCheckConfigProperty(*, type, failure_threshold=None, resource_path=None)
Bases:
object
Public DNS and HTTP namespaces only. A complex type that contains settings for an optional health check. If you specify settings for a health check, AWS Cloud Map associates the health check with the records that you specify in
DnsConfig
.If you specify a health check configuration, you can specify either
HealthCheckCustomConfig
orHealthCheckConfig
but not both.Health checks are basic Route 53 health checks that monitor an AWS endpoint. For information about pricing for health checks, see Amazon Route 53 Pricing .
Note the following about configuring health checks.
A and AAAA records - If
DnsConfig
includes configurations for bothA
andAAAA
records, AWS Cloud Map creates a health check that uses the IPv4 address to check the health of the resource. If the endpoint tthat’s specified by the IPv4 address is unhealthy, Route 53 considers both theA
andAAAA
records to be unhealthy.CNAME records - You can’t specify settings for
HealthCheckConfig
when theDNSConfig
includesCNAME
for the value ofType
. If you do, theCreateService
request will fail with anInvalidInput
error.Request interval - A Route 53 health checker in each health-checking AWS Region sends a health check request to an endpoint every 30 seconds. On average, your endpoint receives a health check request about every two seconds. However, health checkers don’t coordinate with one another. Therefore, you might sometimes see several requests in one second that’s followed by a few seconds with no health checks at all.
Health checking regions - Health checkers perform checks from all Route 53 health-checking Regions. For a list of the current Regions, see Regions .
Alias records - When you register an instance, if you include the
AWS_ALIAS_DNS_NAME
attribute, AWS Cloud Map creates a Route 53 alias record. Note the following:Route 53 automatically sets
EvaluateTargetHealth
to true for alias records. WhenEvaluateTargetHealth
is true, the alias record inherits the health of the referenced AWS resource. such as an ELB load balancer. For more information, see EvaluateTargetHealth .If you include
HealthCheckConfig
and then use the service to register an instance that creates an alias record, Route 53 doesn’t create the health check.Charges for health checks - Health checks are basic Route 53 health checks that monitor an AWS endpoint. For information about pricing for health checks, see Amazon Route 53 Pricing .
- Parameters:
type (
str
) – The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy. .. epigraph:: You can’t change the value ofType
after you create a health check. You can create the following types of health checks: - HTTP : Route 53 tries to establish a TCP connection. If successful, Route 53 submits an HTTP request and waits for an HTTP status code of 200 or greater and less than 400. - HTTPS : Route 53 tries to establish a TCP connection. If successful, Route 53 submits an HTTPS request and waits for an HTTP status code of 200 or greater and less than 400. .. epigraph:: If you specify HTTPS for the value ofType
, the endpoint must support TLS v1.0 or later. - TCP : Route 53 tries to establish a TCP connection. If you specifyTCP
forType
, don’t specify a value forResourcePath
. For more information, see How Route 53 Determines Whether an Endpoint Is Healthy in the Route 53 Developer Guide .failure_threshold (
Union
[int
,float
,None
]) –The number of consecutive health checks that an endpoint must pass or fail for Route 53 to change the current status of the endpoint from unhealthy to healthy or the other way around. For more information, see How Route 53 Determines Whether an Endpoint Is Healthy in the Route 53 Developer Guide .
resource_path (
Optional
[str
]) – The path that you want Route 53 to request when performing health checks. The path can be any value that your endpoint returns an HTTP status code of a 2xx or 3xx format for when the endpoint is healthy. An example file is/docs/route53-health-check.html
. Route 53 automatically adds the DNS name for the service. If you don’t specify a value forResourcePath
, the default value is/
. If you specifyTCP
forType
, you must not specify a value forResourcePath
.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_servicediscovery as servicediscovery health_check_config_property = servicediscovery.CfnService.HealthCheckConfigProperty( type="type", # the properties below are optional failure_threshold=123, resource_path="resourcePath" )
Attributes
- failure_threshold
The number of consecutive health checks that an endpoint must pass or fail for Route 53 to change the current status of the endpoint from unhealthy to healthy or the other way around.
For more information, see How Route 53 Determines Whether an Endpoint Is Healthy in the Route 53 Developer Guide .
- resource_path
The path that you want Route 53 to request when performing health checks.
The path can be any value that your endpoint returns an HTTP status code of a 2xx or 3xx format for when the endpoint is healthy. An example file is
/docs/route53-health-check.html
. Route 53 automatically adds the DNS name for the service. If you don’t specify a value forResourcePath
, the default value is/
.If you specify
TCP
forType
, you must not specify a value forResourcePath
.
- type
The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy.
You can’t change the value of
Type
after you create a health check.You can create the following types of health checks:
HTTP : Route 53 tries to establish a TCP connection. If successful, Route 53 submits an HTTP request and waits for an HTTP status code of 200 or greater and less than 400.
HTTPS : Route 53 tries to establish a TCP connection. If successful, Route 53 submits an HTTPS request and waits for an HTTP status code of 200 or greater and less than 400.
If you specify HTTPS for the value of
Type
, the endpoint must support TLS v1.0 or later.TCP : Route 53 tries to establish a TCP connection.
If you specify
TCP
forType
, don’t specify a value forResourcePath
.For more information, see How Route 53 Determines Whether an Endpoint Is Healthy in the Route 53 Developer Guide .
HealthCheckCustomConfigProperty
- class CfnService.HealthCheckCustomConfigProperty(*, failure_threshold=None)
Bases:
object
A complex type that contains information about an optional custom health check.
A custom health check, which requires that you use a third-party health checker to evaluate the health of your resources, is useful in the following circumstances:
You can’t use a health check that’s defined by
HealthCheckConfig
because the resource isn’t available over the internet. For example, you can use a custom health check when the instance is in an Amazon VPC. (To check the health of resources in a VPC, the health checker must also be in the VPC.)You want to use a third-party health checker regardless of where your resources are located.
If you specify a health check configuration, you can specify either
HealthCheckCustomConfig
orHealthCheckConfig
but not both.To change the status of a custom health check, submit an
UpdateInstanceCustomHealthStatus
request. AWS Cloud Map doesn’t monitor the status of the resource, it just keeps a record of the status specified in the most recentUpdateInstanceCustomHealthStatus
request.Here’s how custom health checks work:
You create a service.
You register an instance.
You configure a third-party health checker to monitor the resource that’s associated with the new instance.
AWS Cloud Map doesn’t check the health of the resource directly.
The third-party health-checker determines that the resource is unhealthy and notifies your application.
Your application submits an
UpdateInstanceCustomHealthStatus
request.AWS Cloud Map waits for 30 seconds.
If another
UpdateInstanceCustomHealthStatus
request doesn’t arrive during that time to change the status back to healthy, AWS Cloud Map stops routing traffic to the resource.
- Parameters:
failure_threshold (
Union
[int
,float
,None
]) –This parameter is no longer supported and is always set to 1. AWS Cloud Map waits for approximately 30 seconds after receiving an
UpdateInstanceCustomHealthStatus
request before changing the status of the service instance. The number of 30-second intervals that you want AWS Cloud Map to wait after receiving anUpdateInstanceCustomHealthStatus
request before it changes the health status of a service instance. Sending a second or subsequentUpdateInstanceCustomHealthStatus
request with the same value before 30 seconds has passed doesn’t accelerate the change. AWS Cloud Map still waits30
seconds after the first request to make the change.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_servicediscovery as servicediscovery health_check_custom_config_property = servicediscovery.CfnService.HealthCheckCustomConfigProperty( failure_threshold=123 )
Attributes
- failure_threshold
This parameter is no longer supported and is always set to 1.
AWS Cloud Map waits for approximately 30 seconds after receiving an
UpdateInstanceCustomHealthStatus
request before changing the status of the service instance.The number of 30-second intervals that you want AWS Cloud Map to wait after receiving an
UpdateInstanceCustomHealthStatus
request before it changes the health status of a service instance.Sending a second or subsequent
UpdateInstanceCustomHealthStatus
request with the same value before 30 seconds has passed doesn’t accelerate the change. AWS Cloud Map still waits30
seconds after the first request to make the change.