# CfnWorkspaceProps

Properties for defining a `CfnWorkspace`.

Used as props by: [CfnWorkspace](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_aps.CfnWorkspace.html)

- Source: Generated at build time
- Type last changed: v2.199.0 · 27 May 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_aps as aps } from 'aws-cdk-lib';
const cfnWorkspaceProps: aps.CfnWorkspaceProps = {
  alertManagerDefinition: 'alertManagerDefinition',
  alias: 'alias',
  kmsKeyArn: 'kmsKeyArn',
  loggingConfiguration: {
    logGroupArn: 'logGroupArn',
  },
  queryLoggingConfiguration: {
    destinations: [{
      cloudWatchLogs: {
        logGroupArn: 'logGroupArn',
      },
      filters: {
        qspThreshold: 123,
      },
    }],
  },
  tags: [{
    key: 'key',
    value: 'value',
  }],
  workspaceConfiguration: {
    limitsPerLabelSets: [{
      labelSet: [{
        name: 'name',
        value: 'value',
      }],
      limits: {
        maxSeries: 123,
      },
    }],
    outOfOrderTimeWindowInSeconds: 123,
    retentionPeriodInDays: 123,
    ruleQueryOffsetInSeconds: 123,
  },
};
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_aps as aps

cfn_workspace_props = aps.CfnWorkspaceProps(
    alert_manager_definition="alertManagerDefinition",
    alias="alias",
    kms_key_arn="kmsKeyArn",
    logging_configuration=aps.CfnWorkspace.LoggingConfigurationProperty(
        log_group_arn="logGroupArn"
    ),
    query_logging_configuration=aps.CfnWorkspace.QueryLoggingConfigurationProperty(
        destinations=[aps.CfnWorkspace.LoggingDestinationProperty(
            cloud_watch_logs=aps.CfnWorkspace.CloudWatchLogDestinationProperty(
                log_group_arn="logGroupArn"
            ),
            filters=aps.CfnWorkspace.LoggingFilterProperty(
                qsp_threshold=123
            )
        )]
    ),
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    workspace_configuration=aps.CfnWorkspace.WorkspaceConfigurationProperty(
        limits_per_label_sets=[aps.CfnWorkspace.LimitsPerLabelSetProperty(
            label_set=[aps.CfnWorkspace.LabelProperty(
                name="name",
                value="value"
            )],
            limits=aps.CfnWorkspace.LimitsPerLabelSetEntryProperty(
                max_series=123
            )
        )],
        out_of_order_time_window_in_seconds=123,
        retention_period_in_days=123,
        rule_query_offset_in_seconds=123
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.aps.*;

CfnWorkspaceProps cfnWorkspaceProps = CfnWorkspaceProps.builder()
        .alertManagerDefinition("alertManagerDefinition")
        .alias("alias")
        .kmsKeyArn("kmsKeyArn")
        .loggingConfiguration(LoggingConfigurationProperty.builder()
                .logGroupArn("logGroupArn")
                .build())
        .queryLoggingConfiguration(QueryLoggingConfigurationProperty.builder()
                .destinations(List.of(LoggingDestinationProperty.builder()
                        .cloudWatchLogs(CloudWatchLogDestinationProperty.builder()
                                .logGroupArn("logGroupArn")
                                .build())
                        .filters(LoggingFilterProperty.builder()
                                .qspThreshold(123)
                                .build())
                        .build()))
                .build())
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .workspaceConfiguration(WorkspaceConfigurationProperty.builder()
                .limitsPerLabelSets(List.of(LimitsPerLabelSetProperty.builder()
                        .labelSet(List.of(LabelProperty.builder()
                                .name("name")
                                .value("value")
                                .build()))
                        .limits(LimitsPerLabelSetEntryProperty.builder()
                                .maxSeries(123)
                                .build())
                        .build()))
                .outOfOrderTimeWindowInSeconds(123)
                .retentionPeriodInDays(123)
                .ruleQueryOffsetInSeconds(123)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.APS;

var cfnWorkspaceProps = new CfnWorkspaceProps {
    AlertManagerDefinition = "alertManagerDefinition",
    Alias = "alias",
    KmsKeyArn = "kmsKeyArn",
    LoggingConfiguration = new LoggingConfigurationProperty {
        LogGroupArn = "logGroupArn"
    },
    QueryLoggingConfiguration = new QueryLoggingConfigurationProperty {
        Destinations = new [] { new LoggingDestinationProperty {
            CloudWatchLogs = new CloudWatchLogDestinationProperty {
                LogGroupArn = "logGroupArn"
            },
            Filters = new LoggingFilterProperty {
                QspThreshold = 123
            }
        } }
    },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    WorkspaceConfiguration = new WorkspaceConfigurationProperty {
        LimitsPerLabelSets = new [] { new LimitsPerLabelSetProperty {
            LabelSet = new [] { new LabelProperty {
                Name = "name",
                Value = "value"
            } },
            Limits = new LimitsPerLabelSetEntryProperty {
                MaxSeries = 123
            }
        } },
        OutOfOrderTimeWindowInSeconds = 123,
        RetentionPeriodInDays = 123,
        RuleQueryOffsetInSeconds = 123
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnWorkspaceProps := &CfnWorkspaceProps{
	AlertManagerDefinition: jsii.String("alertManagerDefinition"),
	Alias: jsii.String("alias"),
	KmsKeyArn: jsii.String("kmsKeyArn"),
	LoggingConfiguration: &LoggingConfigurationProperty{
		LogGroupArn: jsii.String("logGroupArn"),
	},
	QueryLoggingConfiguration: &QueryLoggingConfigurationProperty{
		Destinations: []interface{}{
			&LoggingDestinationProperty{
				CloudWatchLogs: &CloudWatchLogDestinationProperty{
					LogGroupArn: jsii.String("logGroupArn"),
				},
				Filters: &LoggingFilterProperty{
					QspThreshold: jsii.Number(123),
				},
			},
		},
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	WorkspaceConfiguration: &WorkspaceConfigurationProperty{
		LimitsPerLabelSets: []interface{}{
			&LimitsPerLabelSetProperty{
				LabelSet: []interface{}{
					&LabelProperty{
						Name: jsii.String("name"),
						Value: jsii.String("value"),
					},
				},
				Limits: &LimitsPerLabelSetEntryProperty{
					MaxSeries: jsii.Number(123),
				},
			},
		},
		OutOfOrderTimeWindowInSeconds: jsii.Number(123),
		RetentionPeriodInDays: jsii.Number(123),
		RuleQueryOffsetInSeconds: jsii.Number(123),
	},
}
```

## Properties

- `alertManagerDefinition`: string — The alert manager definition, a YAML configuration for the alert manager in your Amazon Managed Service for Prometheus workspace.

  For details about the alert manager definition, see [Creating an alert manager configuration files](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alertmanager-config.html) in the *Amazon Managed Service for Prometheus User Guide* .

  The following example shows part of a CloudFormation YAML file with an embedded alert manager definition (following the `- |-` ).

  `Workspace: Type: AWS::APS::Workspace .... Properties: .... AlertManagerDefinition: Fn::Sub: - |- alertmanager_config: | templates: - 'default_template' route: receiver: example-sns receivers: - name: example-sns sns_configs: - topic_arn: 'arn:aws:sns:${AWS::Region}:${AWS::AccountId}:${TopicName}' -`

- `alias`: string — The alias that is assigned to this workspace to help identify it.

  It does not need to be unique.

- `kmsKeyArn`: string — (optional) The ARN for a customer managed AWS key to use for encrypting data within your workspace.

  For more information about using your own key in your workspace, see [Encryption at rest](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) in the *Amazon Managed Service for Prometheus User Guide* .

- `loggingConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnWorkspace.LoggingConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_aps.CfnWorkspace.LoggingConfigurationProperty.html) — Contains information about the logging configuration for the workspace.

- `queryLoggingConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnWorkspace.QueryLoggingConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_aps.CfnWorkspace.QueryLoggingConfigurationProperty.html) — The definition of logging configuration in an Amazon Managed Service for Prometheus workspace.

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — The list of tag keys and values that are associated with the workspace.

- `workspaceConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnWorkspace.WorkspaceConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_aps.CfnWorkspace.WorkspaceConfigurationProperty.html) — Use this structure to define label sets and the ingestion limits for time series that match label sets, and to specify the retention period of the workspace.
