This release is a pre-release and may not be stable for production use.
multi-az-observability
This is a CDK construct for multi-AZ observability to help detect single-AZ impairments. This is currently an alpha version, but is being used in the AWS Advanced Multi-AZ Resilience Patterns workshop.
There is a lot of available information to think through and combine to provide signals about single-AZ impact. To simplify the setup and use reasonable defaults, this construct (available in TypeScript, Go, Python, .NET, and Java) sets up the necessary observability. To use the CDK construct, you first define your service like this:
from aws_cdk.aws_ec2 import SubnetSelection
service = Service(
service_name="test",
availability_zone_names=vpc.availability_zones,
base_url="http://www.example.com",
fault_count_threshold=25,
period=Duration.seconds(60),
load_balancer=load_balancer,
target_groups=[target_group1, target_group2],
default_availability_metric_details=ServiceAvailabilityMetricDetails(
metric_namespace="front-end/metrics",
success_metric_names=["Success"],
fault_metric_names=["Fault", "Error"],
alarm_statistic="Sum",
unit=Unit.COUNT,
period=Duration.seconds(60),
evaluation_periods=5,
datapoints_to_alarm=3,
success_alarm_threshold=99.9,
fault_alarm_threshold=0.1,
graphed_fault_statistics=["Sum"],
graphed_success_statistics=["Sum"]
),
default_latency_metric_details=ServiceLatencyMetricDetails(
metric_namespace="front-end/metrics",
success_metric_names=["SuccessLatency"],
fault_metric_names=["FaultLatency"],
alarm_statistic="p99",
unit=Unit.MILLISECONDS,
period=Duration.seconds(60),
evaluation_periods=5,
datapoints_to_alarm=3,
success_alarm_threshold=Duration.millis(150),
graphed_fault_statistics=["p99"],
graphed_success_statistics=["p50", "p99", "tm99"]
),
default_contributor_insight_rule_details=ContributorInsightRuleDetails(
success_latency_metric_json_path="$.SuccessLatency",
fault_metric_json_path="$.Faults",
operation_name_json_path="$.Operation",
instance_id_json_path="$.InstanceId",
availability_zone_id_json_path="$.AZ-ID",
log_groups=[log_group]
),
canary_test_props=AddCanaryTestProps(
request_count=10,
schedule="rate(1 minute)",
load_balancer=load_balancer,
network_configuration=NetworkConfigurationProps(
vpc=vpc,
subnet_selection=SubnetSelection(subnet_type=SubnetType.PRIVATE_ISOLATED)
)
),
minimum_unhealthy_targets=MinimumUnhealthyTargets(
percentage=0.1
)
)
ride_operation = {
"operation_name": "ride",
"service": service,
"path": "/ride",
"critical": True,
"http_methods": ["GET"],
"server_side_contributor_insight_rule_details": ContributorInsightRuleDetails(
log_groups=[log_group],
success_latency_metric_json_path="$.SuccessLatency",
fault_metric_json_path="$.Faults",
operation_name_json_path="$.Operation",
instance_id_json_path="$.InstanceId",
availability_zone_id_json_path="$.AZ-ID"
),
"server_side_availability_metric_details": OperationAvailabilityMetricDetails(OperationAvailabilityMetricDetailsProps(
operation_name="ride",
metric_dimensions=MetricDimensions({"Operation": "ride"}, "AZ-ID", "Region")
), service.default_availability_metric_details),
"server_side_latency_metric_details": OperationLatencyMetricDetails(OperationLatencyMetricDetailsProps(
operation_name="ride",
metric_dimensions=MetricDimensions({"Operation": "ride"}, "AZ-ID", "Region")
), service.default_latency_metric_details)
}
pay_operation = {
"operation_name": "pay",
"service": service,
"path": "/pay",
"critical": True,
"http_methods": ["GET"],
"server_side_contributor_insight_rule_details": ContributorInsightRuleDetails(
log_groups=[log_group],
success_latency_metric_json_path="$.SuccessLatency",
fault_metric_json_path="$.Faults",
operation_name_json_path="$.Operation",
instance_id_json_path="$.InstanceId",
availability_zone_id_json_path="$.AZ-ID"
),
"server_side_availability_metric_details": OperationAvailabilityMetricDetails(OperationAvailabilityMetricDetailsProps(
operation_name="pay",
metric_dimensions=MetricDimensions({"Operation": "ride"}, "AZ-ID", "Region")
), service.default_availability_metric_details),
"server_side_latency_metric_details": OperationLatencyMetricDetails(OperationLatencyMetricDetailsProps(
operation_name="pay",
metric_dimensions=MetricDimensions({"Operation": "ride"}, "AZ-ID", "Region")
), service.default_latency_metric_details)
}
service.add_operation(ride_operation)
service.add_operation(pay_operation)
Then you provide that service definition to the CDK construct.
InstrumentedServiceMultiAZObservability(stack, "MAZObservability",
create_dashboards=True,
service=service,
interval=Duration.minutes(60)
)
You define some characteristics of the service, default values for metrics and alarms, and then add operations as well as any overrides for default values that you need. The construct can also automatically create synthetic canaries that test each operation with a very simple HTTP check, or you can configure your own synthetics and just tell the construct about the metric details and optionally log files. This creates metrics, alarms, and dashboards that can be used to detect single-AZ impact. You can access these alarms from the multiAvailabilityZoneObservability object and use them in your CDK project to start automation, send SNS notifications, or incorporate in your own dashboards.
If you don't have service specific logs and custom metrics with per-AZ dimensions, you can still use the construct to evaluate ALB and/or NAT Gateway metrics to find single AZ impairments.
BasicServiceMultiAZObservability(stack, "MAZObservability",
application_load_balancer_props=ApplicationLoadBalancerDetectionProps(
alb_target_group_map=[AlbTargetGroupMap(
application_load_balancer=ApplicationLoadBalancer(stack, "alb",
vpc=vpc,
cross_zone_enabled=True
),
target_groups=[target_group1, target_group2
]
)
],
fault_count_percent_threshold=1,
latency_statistic=Stats.percentile(99),
latency_threshold=Duration.millis(200),
latency_outlier_algorithm=ApplicationLoadBalancerLatencyOutlierAlgorithm.STATIC,
latency_outlier_threshold=45
),
nat_gateway_props=NatGatewayDetectionProps(
nat_gateways={
"us-east-1a": [nat_gateway1],
"us-east-1b": [nat_gateway2],
"us-east-1c": [nat_gateway3]
},
packet_loss_percent_threshold=0.01
),
service_name="test",
period=Duration.seconds(60),
create_dashboard=True,
evaluation_periods=5,
datapoints_to_alarm=3
)
If you provide a load balancer, the construct assumes it is deployed in each AZ of the VPC the load balancer is associated with and will look for HTTP metrics using those AZs as dimensions.
Both options support running workloads on EC2, ECS, Lambda, and EKS.
Metadata
Release files for cdklabs.multi-az-observability 0.0.1a69
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cdklabs_multi_az_observability-0.0.1a69.tar.gz | 22.7 MB | With provenance | Details for cdklabs_multi_az_observability-0.0.1a69.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cdklabs_multi_az_observability-0.0.1a69-py3-none-any.whl | Python 3 | none | any | Details for cdklabs_multi_az_observability-0.0.1a69-py3-none-any.whl |
Total release size: 45.5 MB
Release files / cdklabs_multi_az_observability-0.0.1a69.tar.gz
| Download URL | cdklabs_multi_az_observability-0.0.1a69.tar.gz |
|---|---|
| Size | 22.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dd4a97d84157ccdf9cea0393ebff4e0483caf65b8349012ee1877e07becc53c
|
|
BLAKE2b-256 checksum How to use checksums |
0bbdf277a3d244539fe9773c305994656f5259520398d56a609f2744dd2fc0c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.14.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / cdklabs_multi_az_observability-0.0.1a69-py3-none-any.whl
| Download URL | cdklabs_multi_az_observability-0.0.1a69-py3-none-any.whl |
|---|---|
| Size | 22.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4886f60ec25cebb6d17922414dca0c2990c9fb77c8f05936c6cbe4511109e726
|
|
BLAKE2b-256 checksum How to use checksums |
6c443d3bc40d9ac3fa4f4bfc8de9eebaf44d5439d2c05f901bad0df3941f8bb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.14.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logSecurity for cdklabs.multi-az-observability 0.0.1a69
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cdklabs_multi_az_observability-0.0.1a69.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.