# Environment

The deployment environment for a stack.

- Source: [`core/lib/environment.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/core/lib/environment.ts#L4)
- Type last changed: v2.37.0 · 9 Aug 2022

## Example

```ts
const stack1 = new Stack(app, 'Stack1', {
  env: {
    region: 'us-east-1',
  },
});
const cert = new acm.Certificate(stack1, 'Cert', {
  domainName: '*.example.com',
  validation: acm.CertificateValidation.fromDns(route53.PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'Z0329774B51CGXTDQV3X')),
});

const stack2 = new Stack(app, 'Stack2', {
  env: {
    region: 'us-east-2',
  },
});
new cloudfront.Distribution(stack2, 'Distribution', {
  defaultBehavior: {
    origin: new origins.HttpOrigin('example.com'),
  },
  domainNames: ['dev.example.com'],
  certificate: cert,
});
```

## Properties

- `account`: string = Aws.ACCOUNT_ID which means that the stack will be account-agnostic. — The AWS account ID for this environment.

  This can be either a concrete value such as `585191031104` or `Aws.ACCOUNT_ID` which
  indicates that account ID will only be determined during deployment (it
  will resolve to the CloudFormation intrinsic `{"Ref":"AWS::AccountId"}`).
  Note that certain features, such as cross-stack references and
  environmental context providers require concrete region information and
  will cause this stack to emit synthesis errors.

  **Default:** Aws.ACCOUNT_ID which means that the stack will be account-agnostic.

- `region`: string = Aws.REGION which means that the stack will be region-agnostic. — The AWS region for this environment.

  This can be either a concrete value such as `eu-west-2` or `Aws.REGION`
  which indicates that account ID will only be determined during deployment
  (it will resolve to the CloudFormation intrinsic `{"Ref":"AWS::Region"}`).
  Note that certain features, such as cross-stack references and
  environmental context providers require concrete region information and
  will cause this stack to emit synthesis errors.

  **Default:** Aws.REGION which means that the stack will be region-agnostic.
