Skip to content
v2.277.0

ResourceEnvironment Struct ​

Represents the environment a given resource lives in.

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

Example ​

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
# 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
// 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();
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"
};
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 ​

accountstringaccountstraccountStringAccountstringAccount*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.

regionstringregionstrregionStringRegionstringRegion*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.