aws-cdk
aws-cdk copied to clipboard
cdk_monitoring_constructs: failed to read values from parameter store
Describe the bug
I'm trying to read values from string list parameter that was created in a different stack (the code for the other stack works and the parameter store got created) when using cdk_monitoring_constructs
module. However, i keep getting this error
@jsii/kernel.RuntimeError: Error: Resolution error: Resolution error: Resolution error: Resolution error: Resolution error: Cannot add elements to list token, got: AWS/EC2,CPUUtilization,InstanceId,#{Token[TOKEN.2245]},[object Object].
Object creation stack:
at stack traces disabled.
Object creation stack:
at Execute again with CDK_DEBUG=true to capture stack traces.
Object creation stack:
at Execute again with CDK_DEBUG=true to capture stack traces..
at Kernel._Kernel_ensureSync (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:10491:23)
at Kernel.invoke (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:9855:102)
at KernelHost.processRequest (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11696:36)
at KernelHost.run (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11656:22)
at Immediate._onImmediate (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11657:46)
at process.processImmediate (node:internal/timers:476:21)
here is my code,
worker_instance_ids = ssm.StringListParameter.from_string_list_parameter_name(
self,
"WorkerInstanceIdsParam",
string_list_parameter_name="worker-instance-ids",
).string_list_value
consolidated_dashboard = MonitoringFacade(
self, f"{props.prefix}-Consolidated-Dashboard"
)
consolidated_dashboard.monitor_ec2_instances(
instance_ids=worker_instance_ids,
human_readable_name="Worker Instance",
)
Expected Behavior
The strings inside parameter store list should have been passed and consumed normally because instance_ids
expect Sequence[str]
and i am passing a List[str].
Current Behavior
I'm getting this error
@jsii/kernel.RuntimeError: Error: Resolution error: Resolution error: Resolution error: Resolution error: Resolution error: Cannot add elements to list token, got: AWS/EC2,CPUUtilization,InstanceId,#{Token[TOKEN.2245]},[object Object].
Object creation stack:
at stack traces disabled.
Object creation stack:
at Execute again with CDK_DEBUG=true to capture stack traces.
Object creation stack:
at Execute again with CDK_DEBUG=true to capture stack traces..
at Kernel._Kernel_ensureSync (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:10491:23)
at Kernel.invoke (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:9855:102)
at KernelHost.processRequest (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11696:36)
at KernelHost.run (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11656:22)
at Immediate._onImmediate (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11657:46)
at process.processImmediate (node:internal/timers:476:21)
Reproduction Steps
Please read the description above
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.131.0 (build 92b912d)
Framework Version
No response
Node.js Version
v18.17.1
OS
windows
Language
Python
Language Version
3.11.1
Other information
No response
Hi @andreprawira,
Good morning. Thanks for reporting the issue. Per documentation for ssm::StringListParameter.from_string_list_parameter_name(), the return type of this method is IStringListParameter (not list or array of string values). It is an IStringListParameter
object. Instead, IStringListParameter.string_list_value property should be used, if instance_ids
in your code accept a string sequence.
Please confirm if above guidance works.
Thanks, Ashish
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.