interface Environment
Language | Type name |
---|---|
.NET | Amazon.CDK.Environment |
Go | github.com/aws/aws-cdk-go/awscdk/v2#Environment |
Java | software.amazon.awscdk.Environment |
Python | aws_cdk.Environment |
TypeScript (source) | aws-cdk-lib » Environment |
The deployment environment for a stack.
Example
import * as cdk from 'aws-cdk-lib';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack', { env: { region: 'us-west-2' } });
const globalTable = new dynamodb.TableV2(stack, 'GlobalTable', {
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
replicas: [{ region: 'us-east-1' }],
});
globalTable.addReplica({ region: 'us-east-2', deletionProtection: true });
Properties
Name | Type | Description |
---|---|---|
account? | string | The AWS account ID for this environment. |
region? | string | The AWS region for this environment. |
account?
Type:
string
(optional, default: 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.
region?
Type:
string
(optional, default: 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.