# Environment

An AWS AppConfig environment.

[disable-awslint:no-grants]

Extends: Construct › Resource › Environment
Implements: IResource, IEnvironment, IExtensible, IEnvironmentAware, IEnvironmentRef, IConstruct, IDependable

- CloudFormation: [`AWS::AppConfig::Environment`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-appconfig-environment.html)
- L1 type: [`CfnEnvironment`](/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.CfnEnvironment.html)
- Source: [`aws-appconfig/lib/environment.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appconfig/lib/environment.ts#L214)
- Type last changed: v2.233.0 · 18 Dec 2025

## Example

```ts
const app = new appconfig.Application(this, 'MyApp');
const env = new appconfig.Environment(this, 'MyEnv', {
  application: app,
});

new appconfig.HostedConfiguration(this, 'MyFirstHostedConfig', {
  application: app,
  deployTo: [env],
  content: appconfig.ConfigurationContent.fromInlineText('This is my first configuration content.'),
});

new appconfig.HostedConfiguration(this, 'MySecondHostedConfig', {
  application: app,
  deployTo: [env],
  content: appconfig.ConfigurationContent.fromInlineText('This is my second configuration content.'),
});
```

## Initializer

```ts
new Environment(scope: Construct, id: string, props: EnvironmentProps)
```

## Construct Props

- `application`: [IApplication](/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.IApplication.html) (required) — The application to be associated with the environment.

- `deletionProtectionCheck`: [DeletionProtectionCheck](/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.DeletionProtectionCheck.html) — A property to prevent accidental deletion of active environments.

  **Default:** undefined - AppConfig default is ACCOUNT_DEFAULT

- `description`: string — The description of the environment.

  **Default:** No description.

- `environmentName`: string — The name of the environment.

  **Default:** A name is generated.

- `monitors`: [Monitor](/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.Monitor.html)[] — The monitors for the environment.

  **Default:** No monitors.

## Properties

- `application`: [IApplication](/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.IApplication.html) — The application associated with the environment.

- `applicationId`: string — The ID of the environment.

- `description`: string — The description of the environment.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `environmentArn`: string — The Amazon Resource Name (ARN) of the environment.

- `environmentId`: string — The ID of the environment.

- `environmentRef`: [EnvironmentReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_appconfig.EnvironmentReference.html) — A reference to a Environment resource.

- `monitors`: [Monitor](/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.Monitor.html)[] — The monitors for the environment.

- `name`: string — The name of the environment.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `addDeployment(configuration: IConfiguration): void` — Creates a deployment of the supplied configuration to this environment.

  Note that you can only deploy one configuration at a time to an environment.
  However, you can deploy one configuration each to different environments at the same time.
  If more than one deployment is requested for this environment, they will occur in the same order they were provided.

- `addDeployments(...configurations: IConfiguration[]): void` — Creates a deployment for each of the supplied configurations to this environment.

  These configurations will be deployed in the same order as the input array.

- `addExtension(extension: IExtension): void` — Adds an extension association to the environment.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and also creates an extension association to an application.

- `fromEnvironmentArn(scope: Construct, id: string, environmentArn: string): IEnvironment` (static) — Imports an environment into the CDK using its Amazon Resource Name (ARN).

  **Parameters**

  - `scope` — The parent construct.
  - `id` — The name of the environment construct.
  - `environmentArn` — The Amazon Resource Name (ARN) of the environment.

- `fromEnvironmentAttributes(scope: Construct, id: string, attrs: EnvironmentAttributes): IEnvironment` (static) — Imports an environment into the CDK from its attributes.

  **Parameters**

  - `scope` — The parent construct.
  - `id` — The name of the environment construct.
  - `attrs` — The attributes of the environment.

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — [disable-awslint:no-grants].

- `grantReadConfig(identity: IGrantable): Grant` — [disable-awslint:no-grants].

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `on(actionPoint: ActionPoint, eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an extension defined by the action point and event destination and also creates an extension association to the environment.

- `onDeploymentBaking(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an ON_DEPLOYMENT_BAKING extension with the provided event destination and also creates an extension association to the environment.

- `onDeploymentComplete(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an ON_DEPLOYMENT_COMPLETE extension with the provided event destination and also creates an extension association to the environment.

- `onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an ON_DEPLOYMENT_ROLLED_BACK extension with the provided event destination and also creates an extension association to the environment.

- `onDeploymentStart(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an ON_DEPLOYMENT_START extension with the provided event destination and also creates an extension association to the environment.

- `onDeploymentStep(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds an ON_DEPLOYMENT_STEP extension with the provided event destination and also creates an extension association to the environment.

- `preCreateHostedConfigurationVersion(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds a PRE_CREATE_HOSTED_CONFIGURATION_VERSION extension with the provided event destination and also creates an extension association to the environment.

- `preStartDeployment(eventDestination: IEventDestination, options?: ExtensionOptions): void` — Adds a PRE_START_DEPLOYMENT extension with the provided event destination and also creates an extension association to the environment.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
