Skip to content

Environment Variables in AWS CDK

Updated: at 09:43 AM

CDK Environment Variable

  1. CDK_DEFAULT_ACCOUNT: This variable represents the AWS account ID where the CDK application will be deployed. It is usually inferred from the default AWS credentials configuration.
  2. CDK_DEFAULT_REGION: This variable specifies the AWS region where the stack will be deployed. It is often set based on the default region configuration in the AWS CLI or SDK.
  3. CDK_DEPLOY_REGION: This is used to explicitly specify the region for deployment, overriding the default region set by CDK_DEFAULT_REGION.
  4. CDK_DEPLOY_ACCOUNT: Similar to CDK_DEPLOY_REGION, this variable specifies the account ID for deployment, overriding the default account set by CDK_DEFAULT_ACCOUNT.
  5. CDK_CONTEXT_JSON: This variable allows you to pass context information to the CDK app in JSON format. Context information can be used to customize the behavior of the CDK app.
  6. CDK_DEBUG: When set to true, this variable enables debug output for the CDK commands, providing more detailed logs for troubleshooting purposes.
  7. CDK_OUTDIR: Specifies the directory where the synthesized cloud assembly will be output. By default, this is set to cdk.out.
  8. CDK_CLI_ASM_VERSION: Specifies the version of the cloud assembly schema that the CLI will use to interact with the application. This can be useful for ensuring compatibility between different versions of the CDK CLI and the application.
  9. CDK_PLUGIN: This variable allows specifying plugins that should be loaded by the CDK CLI. Plugins can extend or modify the behavior of the CDK commands.
  10. AWS_PROFILE: Defines the AWS CLI profile to use for authentication and authorization. This profile contains the credentials and region configuration for the AWS account.
  11. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN: These variables are used to specify AWS credentials directly. They can be used as an alternative to the AWS profile.
  12. AWS_DEFAULT_REGION: Sets the default region for AWS operations. It can override the region configured in the AWS profile.
If you enjoy the content, please consider supporting work