HttpRetryPolicy

class aws_cdk.aws_appmesh.HttpRetryPolicy(*, retry_attempts, retry_timeout, http_retry_events=None, tcp_retry_events=None)

Bases: object

HTTP retry policy.

Parameters
  • retry_attempts (Union[int, float]) – The maximum number of retry attempts.

  • retry_timeout (Duration) – The timeout for each retry attempt.

  • http_retry_events (Optional[Sequence[HttpRetryEvent]]) – Specify HTTP events on which to retry. You must specify at least one value for at least one types of retry events. Default: - no retries for http events

  • tcp_retry_events (Optional[Sequence[TcpRetryEvent]]) – TCP events on which to retry. The event occurs before any processing of a request has started and is encountered when the upstream is temporarily or permanently unavailable. You must specify at least one value for at least one types of retry events. Default: - no retries for tcp events

ExampleMetadata

infused

Example:

# router is of type VirtualRouter
# node is of type VirtualNode


router.add_route("route-http2-retry",
    route_spec=appmesh.RouteSpec.http2(
        weighted_targets=[appmesh.WeightedTarget(virtual_node=node)],
        retry_policy=appmesh.HttpRetryPolicy(
            # Retry if the connection failed
            tcp_retry_events=[appmesh.TcpRetryEvent.CONNECTION_ERROR],
            # Retry if HTTP responds with a gateway error (502, 503, 504)
            http_retry_events=[appmesh.HttpRetryEvent.GATEWAY_ERROR],
            # Retry five times
            retry_attempts=5,
            # Use a 1 second timeout per retry
            retry_timeout=cdk.Duration.seconds(1)
        )
    )
)

Attributes

http_retry_events

Specify HTTP events on which to retry.

You must specify at least one value for at least one types of retry events.

Default
  • no retries for http events

Return type

Optional[List[HttpRetryEvent]]

retry_attempts

The maximum number of retry attempts.

Return type

Union[int, float]

retry_timeout

The timeout for each retry attempt.

Return type

Duration

tcp_retry_events

TCP events on which to retry.

The event occurs before any processing of a request has started and is encountered when the upstream is temporarily or permanently unavailable. You must specify at least one value for at least one types of retry events.

Default
  • no retries for tcp events

Return type

Optional[List[TcpRetryEvent]]