interface Environment
Language | Type name |
---|---|
![]() | Amazon.CDK.Environment |
![]() | software.amazon.awscdk.core.Environment |
![]() | aws_cdk.core.Environment |
![]() | @aws-cdk/core » Environment |
The deployment environment for a stack.
Example
// Passing a replication bucket created in a different stack.
const app = new App();
const replicationStack = new Stack(app, 'ReplicationStack', {
env: {
region: 'us-west-1',
},
});
const key = new kms.Key(replicationStack, 'ReplicationKey');
const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', {
// like was said above - replication buckets need a set physical name
bucketName: PhysicalName.GENERATE_IF_NEEDED,
encryptionKey: key, // does not work!
});
// later...
new codepipeline.Pipeline(replicationStack, 'Pipeline', {
crossRegionReplicationBuckets: {
'us-west-1': replicationBucket,
},
});
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.accountId 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.accountId
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 concerete 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 concerete region information and
will cause this stack to emit synthesis errors.