Class AlarmFactory

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
com.cloudforgeci.api.core.annotation.BaseFactory
com.cloudforgeci.api.observability.AlarmFactory
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

public class AlarmFactory extends BaseFactory
Creates CloudWatch alarms for application health monitoring.

This factory sets up alarms to notify you when your infrastructure isn't behaving as expected. Alarms are automatically tuned based on your security profile - stricter thresholds in production, more relaxed in development.

Alarms Created

  • ALB 5xx Errors - Backend server errors indicating infrastructure problems
  • ALB 4xx Errors - Client errors that might indicate misconfiguration
  • High Response Time - Performance degradation alerts

Usage


 new AlarmFactory(this, "Alarms", new AlarmFactory.Props());
 

The factory automatically connects to your load balancer through the context system. All alarms adapt to your environment - production gets strict monitoring, development stays lenient to avoid alert fatigue.

Threshold Examples

Alarm Thresholds by Security Profile
AlarmDevStagingProduction
5xx Errors10/min7/min5/min
4xx Errors50/5min30/5min20/5min
Response Time5s3s2s
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Configuration properties for alarm creation.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.constructs.IConstruct

    software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy
  • Field Summary

    Fields inherited from class com.cloudforgeci.api.core.annotation.BaseFactory

    cfc, config, ctx
  • Constructor Summary

    Constructors
    Constructor
    Description
    AlarmFactory(software.constructs.Construct scope, String id, AlarmFactory.Props p)
    Creates a new alarm factory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Creates CloudWatch alarms for the application load balancer.

    Methods inherited from class com.cloudforgeci.api.core.annotation.BaseFactory

    getDeploymentContext, getSecurityProfileConfiguration, getSystemContext

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, toString

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • AlarmFactory

      public AlarmFactory(software.constructs.Construct scope, String id, AlarmFactory.Props p)
      Creates a new alarm factory.
      Parameters:
      scope - the CDK construct scope
      id - the construct ID
      p - configuration properties (reserved for future use)
  • Method Details

    • create

      public void create()
      Creates CloudWatch alarms for the application load balancer.

      Sets up multiple alarms covering error rates and response times. All thresholds adapt automatically to your security profile for appropriate sensitivity in each environment.

      Lifecycle: Alarms are automatically deleted when the CloudFormation stack is destroyed. No manual cleanup required.

      Specified by:
      create in class BaseFactory