Skip to content
v2.277.0

Experimental

@aws-cdk/aws-apprunner-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

HealthCheck Class ​

Contains static factory methods for creating health checks for different protocols.

Example ​

ts
new apprunner.Service(this, 'Service', {
  source: apprunner.Source.fromEcrPublic({
    imageConfiguration: { port: 8000 },
    imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest',
  }),
  healthCheck: apprunner.HealthCheck.http({
    healthyThreshold: 5,
    interval: Duration.seconds(10),
    path: '/',
    timeout: Duration.seconds(10),
    unhealthyThreshold: 10,
  }),
});
python
apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    health_check=apprunner.HealthCheck.http(
        healthy_threshold=5,
        interval=Duration.seconds(10),
        path="/",
        timeout=Duration.seconds(10),
        unhealthy_threshold=10
    )
)
java
Service.Builder.create(this, "Service")
        .source(Source.fromEcrPublic(EcrPublicProps.builder()
                .imageConfiguration(ImageConfiguration.builder().port(8000).build())
                .imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
                .build()))
        .healthCheck(HealthCheck.http(HttpHealthCheckOptions.builder()
                .healthyThreshold(5)
                .interval(Duration.seconds(10))
                .path("/")
                .timeout(Duration.seconds(10))
                .unhealthyThreshold(10)
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.AppRunner.Alpha
new Service(this, "Service", new ServiceProps {
    Source = Source.FromEcrPublic(new EcrPublicProps {
        ImageConfiguration = new ImageConfiguration { Port = 8000 },
        ImageIdentifier = "public.ecr.aws/aws-containers/hello-app-runner:latest"
    }),
    HealthCheck = HealthCheck.Http(new HttpHealthCheckOptions {
        HealthyThreshold = 5,
        Interval = Duration.Seconds(10),
        Path = "/",
        Timeout = Duration.Seconds(10),
        UnhealthyThreshold = 10
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkapprunneralpha/v2
apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
	HealthCheck: apprunner.HealthCheck_Http(&HttpHealthCheckOptions{
		HealthyThreshold: jsii.Number(5),
		Interval: awscdk.Duration_Seconds(jsii.Number(10)),
		Path: jsii.String("/"),
		Timeout: awscdk.Duration_*Seconds(jsii.Number(10)),
		UnhealthyThreshold: jsii.Number(10),
	}),
})

Properties ​

healthCheckProtocolTypeHealthCheckProtocolTypehealth_check_protocol_typeHealthCheckProtocolTypehealthCheckProtocolTypeHealthCheckProtocolTypeHealthCheckProtocolTypeHealthCheckProtocolTypeHealthCheckProtocolTypeHealthCheckProtocolType#
healthyThresholdnumberhealthy_thresholdint | floathealthyThresholdNumberHealthyThresholddoubleHealthyThreshold*float64#
intervalDurationintervalDurationintervalDurationIntervalDurationIntervalDuration#
pathmay be undefinedstringpathmay be undefinedstrpathmay be undefinedStringPathmay be undefinedstringPathmay be undefined*string#
timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration#
unhealthyThresholdnumberunhealthy_thresholdint | floatunhealthyThresholdNumberUnhealthyThresholddoubleUnhealthyThreshold*float64#

Methods ​

bind(): CfnService.HealthCheckConfigurationPropertydef bind(self, ) -> HealthCheckConfigurationPropertypublic HealthCheckConfigurationProperty bind()public HealthCheckConfigurationProperty Bind()func Bind() HealthCheckConfigurationProperty#
http(options?: HttpHealthCheckOptions): HealthCheck // chainable@staticmethod def http(options: typing.Optional[HttpHealthCheckOptions] = None) -> HealthCheckpublic static HealthCheck http(HttpHealthCheckOptions options)public static HealthCheck Http(HttpHealthCheckOptions? options = null)func Http(Options HttpHealthCheckOptions) HealthCheckstatic#
Construct a HTTP health check.
tcp(options?: TcpHealthCheckOptions): HealthCheck // chainable@staticmethod def tcp(options: typing.Optional[TcpHealthCheckOptions] = None) -> HealthCheckpublic static HealthCheck tcp(TcpHealthCheckOptions options)public static HealthCheck Tcp(TcpHealthCheckOptions? options = null)func Tcp(Options TcpHealthCheckOptions) HealthCheckstatic#
Construct a TCP health check.