forge-kit

forge-health-aws

Overview

forge-health-aws provides health checks for use with AWS services such as S3, DynamoDb.

It distinguishes between liveness and readiness and supports dependency-aware checks.

This is the only module that is not vendor-agnostic and relies on AWS SDK.


Key Features


Design Principles


Typical Use Cases


Usage

forge-health-aws provides abstract base classes for health checks. To use them, create @Produces methods that return health check instances:

PostgreSQL Health Check

@Produces
@Readiness
@ApplicationScoped
public HealthCheck databaseHealthCheck(EntityManager entityManager) {
    return new PostgresHealthCheck(
        entityManager,
        "mydb",  // Database name
        List.of("users", "orders")  // Tables to check
    ) {};
}

DynamoDB Health Check

@Produces
@Readiness
@ApplicationScoped
public HealthCheck dynamoDbHealthCheck(DynamoDbClient dynamoDbClient) {
    return new DynamoDbHealthCheck(
        dynamoDbClient,
        List.of("Users", "Orders")  // Tables to check
    ) {};
}

S3 Health Check

@Produces
@Readiness
@ApplicationScoped
public HealthCheck s3HealthCheck(S3Client s3Client) {
    return new S3HealthCheck(
        s3Client,
        List.of("my-bucket", "backup-bucket")  // Buckets to check
    ) {};
}

Cognito Health Check

@Produces
@Readiness
@ApplicationScoped
public HealthCheck cognitoHealthCheck(CognitoIdentityProviderClient cognitoClient) {
    return new CognitoHealthCheck(
        cognitoClient,
        "us-east-1_ABC123",  // User Pool ID
        "MyUserPool"  // User Pool name
    ) {};
}

Once registered, health checks are automatically available at:


Examples

See: examples/forge-health-aws

Code examples demonstrate: