# GetContextKeyOptions

- Source: [`core/lib/context-provider.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/core/lib/context-provider.ts#L13)
- Type last changed: v2.201.0 · 13 Jun 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';

declare const props: any;
const getContextKeyOptions: cdk.GetContextKeyOptions = {
  provider: 'provider',

  // the properties below are optional
  additionalCacheKey: 'additionalCacheKey',
  includeEnvironment: false,
  props: {
    propsKey: props,
  },
};
```

Python:

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

# props: Any

get_context_key_options = cdk.GetContextKeyOptions(
    provider="provider",

    # the properties below are optional
    additional_cache_key="additionalCacheKey",
    include_environment=False,
    props={
        "props_key": props
    }
)
```

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.*;

Object props;

GetContextKeyOptions getContextKeyOptions = GetContextKeyOptions.builder()
        .provider("provider")

        // the properties below are optional
        .additionalCacheKey("additionalCacheKey")
        .includeEnvironment(false)
        .props(Map.of(
                "propsKey", props))
        .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;

var props;

var getContextKeyOptions = new GetContextKeyOptions {
    Provider = "provider",

    // the properties below are optional
    AdditionalCacheKey = "additionalCacheKey",
    IncludeEnvironment = false,
    Props = new Dictionary<string, object> {
        { "propsKey", props }
    }
};
```

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 cdk "github.com/aws/aws-cdk-go/awscdk"

var props interface{}

getContextKeyOptions := &GetContextKeyOptions{
	Provider: jsii.String("provider"),

	// the properties below are optional
	AdditionalCacheKey: jsii.String("additionalCacheKey"),
	IncludeEnvironment: jsii.Boolean(false),
	Props: map[string]interface{}{
		"propsKey": props,
	},
}
```

## Properties

- `additionalCacheKey`: string — Adds an additional discriminator to the `cdk.context.json` cache key.

  **Default:** no additional cache key

- `includeEnvironment`: boolean = true — Whether to include the stack's account and region automatically.

- `props`: { [key: string]: any } — Provider-specific properties.

- `provider`: string (required) — The context provider to query.
