# ResourceEnvironment

Represents the environment a given resource lives in.

Used as the return value for the `IEnvironmentAware.env` property.

- Source: [`interfaces/environment-aware.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/interfaces/environment-aware.ts#L24)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { interfaces } from 'aws-cdk-lib';
const resourceEnvironment: interfaces.ResourceEnvironment = {
  account: 'account',
  region: 'region',
};
```

Python:

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

resource_environment = interfaces.ResourceEnvironment(
    account="account",
    region="region"
)
```

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

ResourceEnvironment resourceEnvironment = ResourceEnvironment.builder()
        .account("account")
        .region("region")
        .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.Interfaces;

var resourceEnvironment = new ResourceEnvironment {
    Account = "account",
    Region = "region"
};
```

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"

resourceEnvironment := &ResourceEnvironment{
	Account: jsii.String("account"),
	Region: jsii.String("region"),
}
```

## Properties

- `account`: string (required) — The AWS Account ID that this resource belongs to.

  Since this can be a Token (for example, when the account is
  CloudFormation's `AWS::AccountId` intrinsic), make sure to use
  `Token.compareStrings()` instead of comparing the values with direct
  string equality.

- `region`: string (required) — The AWS Region that this resource belongs to.

  Since this can be a Token (for example, when the region is CloudFormation's
  `AWS::Region` intrinsic), make sure to use `Token.compareStrings()` instead
  of comparing the values with direct string equality.
