> **Experimental**
>
> `@aws-cdk/aws-applicationsignals-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# CloudWatchAgentOptions

Configuration options for the CloudWatch Agent container.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/enablement/ecs-cloudwatch-agent.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-applicationsignals-alpha/lib/enablement/ecs-cloudwatch-agent.ts#L50)

## Example

```ts
import { Construct } from 'constructs';
import * as appsignals from '@aws-cdk/aws-applicationsignals-alpha';
import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as ecs from 'aws-cdk-lib/aws-ecs';

class MyStack extends cdk.Stack {
  public constructor(scope?: Construct, id?: string, props: cdk.StackProps = {}) {
    super();
    const vpc = new ec2.Vpc(this, 'TestVpc', {});
    const cluster = new ecs.Cluster(this, 'TestCluster', { vpc });

    const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'SampleAppTaskDefinition', {
      cpu: 2048,
      memoryLimitMiB: 4096,
    });

    fargateTaskDefinition.addContainer('app', {
      image: ecs.ContainerImage.fromRegistry('test/sample-app'),
    });

    new appsignals.ApplicationSignalsIntegration(this, 'ApplicationSignalsIntegration', {
      taskDefinition: fargateTaskDefinition,
      instrumentation: {
        sdkVersion: appsignals.JavaInstrumentationVersion.V2_10_0,
      },
      serviceName: 'sample-app',
      cloudWatchAgentSidecar: {
        containerName: 'cloudwatch-agent',
        enableLogging: true,
        cpu: 256,
        memoryLimitMiB: 512,
      }
    });

    new ecs.FargateService(this, 'MySampleApp', {
      cluster: cluster,
      taskDefinition: fargateTaskDefinition,
      desiredCount: 1,
    });
  }
}
```

## Properties

- `agentConfig`: string — Custom agent configuration in JSON format.

  **Default:** Uses default configuration for Application Signals

- `containerName`: string (required) — Name of the CloudWatch Agent container.

- `cpu`: number — The minimum number of CPU units to reserve for the container.

  **Default:** No minimum CPU units reserved.

- `enableLogging`: boolean = false — Whether to enable logging for the CloudWatch Agent.

- `essential`: boolean = true — Start as an essential container.

- `memoryLimitMiB`: number — The amount (in MiB) of memory to present to the container.

  **Default:** No memory limit.

- `memoryReservationMiB`: number — The soft limit (in MiB) of memory to reserve for the container.

  **Default:** No memory reserved.

- `operatingSystemFamily`: [OperatingSystemFamily](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.OperatingSystemFamily.html) = Linux — Operating system family for the CloudWatch Agent.

- `portMappings`: [PortMapping](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.PortMapping.html)[] — The port mappings to add to the container definition.

  **Default:** No ports are mapped.
