# Monitor

Defines monitors that will be associated with an AWS AppConfig environment.

Obtainable from: Monitor.fromCfnMonitorsProperty, Monitor.fromCloudWatchAlarm

- Source: [`aws-appconfig/lib/environment.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appconfig/lib/environment.ts#L416)
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

TypeScript:

```ts
declare const application: appconfig.Application;
declare const alarm: cloudwatch.Alarm;
declare const compositeAlarm: cloudwatch.CompositeAlarm;

new appconfig.Environment(this, 'MyEnvironment', {
  application,
  monitors: [
    appconfig.Monitor.fromCloudWatchAlarm(alarm),
    appconfig.Monitor.fromCloudWatchAlarm(compositeAlarm),
  ],
});
```

Python:

```python
# application: appconfig.Application
# alarm: cloudwatch.Alarm
# composite_alarm: cloudwatch.CompositeAlarm

appconfig.Environment(self, "MyEnvironment",
    application=application,
    monitors=[
        appconfig.Monitor.from_cloud_watch_alarm(alarm),
        appconfig.Monitor.from_cloud_watch_alarm(composite_alarm)
    ]
)
```

Java:

```java
Application application;
Alarm alarm;
CompositeAlarm compositeAlarm;

Environment.Builder.create(this, "MyEnvironment")
        .application(application)
        .monitors(List.of(Monitor.fromCloudWatchAlarm(alarm), Monitor.fromCloudWatchAlarm(compositeAlarm)))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Application application;
Alarm alarm;
CompositeAlarm compositeAlarm;

new Environment(this, "MyEnvironment", new EnvironmentProps {
    Application = application,
    Monitors = new [] { Monitor.FromCloudWatchAlarm(alarm), Monitor.FromCloudWatchAlarm(compositeAlarm) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var application Application
var alarm Alarm
var compositeAlarm CompositeAlarm

appconfig.NewEnvironment(this, jsii.String("MyEnvironment"), &EnvironmentProps{
	Application: Application,
	Monitors: []Monitor{
		appconfig.Monitor_FromCloudWatchAlarm(alarm),
		appconfig.Monitor_*FromCloudWatchAlarm(compositeAlarm),
	},
})
```

## Initializer

TypeScript:

```ts
new Monitor()
```

Python:

```python
Monitor()
```

Java:

```java
new Monitor()
```

C# / .NET:

```csharp
new Monitor()
```

Golang:

```go
NewMonitor()
```

## Properties

- `alarmArn`: string — The alarm ARN for AWS AppConfig to monitor.

- `alarmRoleArn`: string — The IAM role ARN for AWS AppConfig to view the alarm state.

- `isCompositeAlarm`: boolean — Indicates whether a CloudWatch alarm is a composite alarm.

- `monitorType`: [MonitorType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.MonitorType.html) — The type of monitor.

## Methods

- `fromCfnMonitorsProperty(monitorsProperty: CfnEnvironment.MonitorsProperty): Monitor // chainable` (static) — Creates a Monitor from a CfnEnvironment.MonitorsProperty construct.

  **Parameters**

  - `monitorsProperty` — The monitors property.

- `fromCloudWatchAlarm(alarm: IAlarmRef, alarmRole?: IRoleRef): Monitor // chainable` (static) — Creates a Monitor from a CloudWatch alarm.

  If the alarm role is not specified, a role will
  be generated.

  **Parameters**

  - `alarm` — The Amazon CloudWatch alarm.
  - `alarmRole` — The IAM role for AWS AppConfig to view the alarm state.
