Open
Description
Environment information
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Memory: 1.11 GB / 15.73 GB
Binaries:
Node: 20.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: undefined - undefined
npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
pnpm: undefined - undefined
NPM Packages:
@aws-amplify/auth-construct: 1.5.1
@aws-amplify/backend: 1.10.0
@aws-amplify/backend-auth: 1.4.2
@aws-amplify/backend-cli: 1.4.4
@aws-amplify/backend-data: 1.2.3
@aws-amplify/backend-deployer: 1.1.12
@aws-amplify/backend-function: 1.10.0
@aws-amplify/backend-output-schemas: 1.4.0
@aws-amplify/backend-output-storage: 1.1.4
@aws-amplify/backend-secret: 1.1.5
@aws-amplify/backend-storage: 1.2.4
@aws-amplify/cli-core: 1.2.1
@aws-amplify/client-config: 1.5.4
@aws-amplify/deployed-backend-client: 1.5.0
@aws-amplify/form-generator: 1.0.3
@aws-amplify/model-generator: 1.0.10
@aws-amplify/platform-core: 1.4.0
@aws-amplify/plugin-types: 1.6.0
@aws-amplify/sandbox: 1.2.8
@aws-amplify/schema-generator: 1.2.6
aws-amplify: 6.10.3
aws-cdk: 2.173.2
aws-cdk-lib: 2.173.2
typescript: 5.7.2
No AWS environment variables
No CDK environment variables
Describe the feature
Related to #999 but didnt find any followup feature request for this
In dotnet i solved it by having this wrapper for the environment:
public class EnvironmentWrapper
{
public static Amazon.CDK.Environment ConstructEnvironment(string account = null, string region = null)
{
return new Amazon.CDK.Environment
{
Account = System.Environment.GetEnvironmentVariable("CDK_DEPLOY_ACCOUNT") ??
account ??
System.Environment.GetEnvironmentVariable("CDK_DEFAULT_ACCOUNT"),
Region = System.Environment.GetEnvironmentVariable("CDK_DEPLOY_REGION") ??
region ??
System.Environment.GetEnvironmentVariable("CDK_DEFAULT_REGION")
};
}
}
It provides a few ways of overriding it, or otherwise go for the default options of nothing, if no overrides are provided
Adding a typescript version like this to the creation of the AmplifyStack
shouldn't break any existing deployments but add the possibility to go specific if needed
Use case
There is a few resources in CDK which you might rather want to do lookups for than hard code its value
My specific one now is VPC, to look up the one created by an outside CDK stack
But same applies for AMIs and parameters etc