-
Notifications
You must be signed in to change notification settings - Fork 358
question / assist for next guy...using aws cli terminal #21
Description
This code might be pretty old, learning cdk and things as i work through this ecs workshop.
I can't figure out how to inject the account: and region: into the cdk synth.
So I added the code direct to the file:
https://github.com/aws-containers/ecsdemo-frontend/blob/main/cdk/app.py ln:349
seems like the _env is jacked or just old
For anyone down road wasting a couple hours.
env={
"account": "123456789012", # your AWS Account ID
"region": "us-west-2" # your desired AWS region
}
kept getting
cdk $ cdk synth
jsii.errors.JavaScriptError:
@jsii/kernel.RuntimeError: Error: Cannot retrieve value from context provider vpc-provider since account/region are not specified at the stack level. Configure "env" with an account and region when you define your stack.See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more details.
at Kernel._Kernel_ensureSync (/tmp/tmp6rar5v94/lib/program.js:931:23)
at Kernel.sinvoke (/tmp/tmp6rar5v94/lib/program.js:315:102)
at KernelHost.processRequest (/tmp/tmp6rar5v94/lib/program.js:15471:36)
at KernelHost.run (/tmp/tmp6rar5v94/lib/program.js:15431:22)
at Immediate._onImmediate (/tmp/tmp6rar5v94/lib/program.js:15432:46)
at process.processImmediate (node:internal/timers:483:21)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cloudshell-user/environment/ecsdemo-frontend/cdk/app.py", line 349, in
FrontendService(app, stack_name, env=_env)
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, **kwargs)
File "/home/cloudshell-user/environment/ecsdemo-frontend/cdk/app.py", line 55, in init
self.base_platform = BasePlatform(self, "BasePlatform")
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, **kwargs)
File "/home/cloudshell-user/environment/ecsdemo-frontend/cdk/app.py", line 24, in init
self.vpc = ec2.Vpc.from_lookup(
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/aws_cdk/aws_ec2/init.py", line 73650, in from_lookup
return typing.cast(IVpc, jsii.sinvoke(cls, "fromLookup", [scope, id, options]))
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/jsii/_kernel/init.py", line 149, in wrapped
return _recursize_dereference(kernel, fn(kernel, *args, **kwargs))
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/jsii/_kernel/init.py", line 418, in sinvoke
response = self.provider.sinvoke(
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/jsii/_kernel/providers/process.py", line 383, in sinvoke
return self._process.send(request, InvokeResponse)
File "/home/cloudshell-user/.local/lib/python3.9/site-packages/jsii/_kernel/providers/process.py", line 342, in send
raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: Error: Cannot retrieve value from context provider vpc-provider since account/region are not specified at the stack level. Configure "env" with an account and region when you define your stack.See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more details.