[aws-ssm] - Retrieve parameters with path and region
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
I'd like to be able to get references/retrieve parameters via their `path` **and** `region`. I can currently do similar to this with S3 Buckets with: [Bucket.from_bucket_attributes](https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/Bucket.html#aws_cdk.aws_s3.Bucket.from_bucket_attributes).
However when I look at a similar method for SSM parameters [StringParameter.from_string_parameter_attributes](https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ssm/StringParameter.html#aws_cdk.aws_ssm.StringParameter.from_string_parameter_attributes) I am unable to pass `region` as a argument. I am also limited to specifying the **one** name. I would like a similar implementation to Boto3s [get_parameters_by_path](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.get_parameters_by_path) which enables a wildcard approach to finding parameters.
Ideally I would like to do something like:
```python
params = StringParameter.from_string_parameter_attributes(path="/my/path/", region="us-west-2")
```
### Use Case
So my scenario is:
An external project can create _n_ randomly named buckets in a region - it stores the names of these buckets under deterministic keys in Parameter Store eg (/project/stage/bucket-name-1)
My stack (in a different region) - wants to import those buckets (use them as references), so I currently do this by using Boto3 and getting the parameters under `/project/stage/` - Doing this gives me the randomly generated bucket names. Then I can use `s3.Bucket.from_bucket_attributes` with the bucket name and the region the bucket was created in, to import those buckets as references into my stack.
This is working, but when I do another deploy (without changing anything) - these references are totally different objects (but still point to the same buckets) so I always have changes according to CDK.
I'd like my proposed features implemented so that I can import SSM parameters in a CDK-style manner, so that my further deploys (with no changes) indicate nothing is different.
### Other
I'm unsure if this is just the CDK which needs this implemented or CloudFormation itself. I see that [CfnParameterProps](https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ssm/CfnParameterProps.html#aws_cdk.aws_ssm.CfnParameterProps) makes no mention of `region` either.
Happy to raise this elsewhere if it belongs in a better place!
* [X] :wave: I may be able to implement this feature request - With a lot of guidance maybe!
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Start by inspecting StringParameter.from_string_parameter_attributes and CfnParameterProps, then compare their capabilities with Bucket.from_bucket_attributes. Check whether CloudFormation supports cross-region, path-based SSM parameter imports and determine how stable synthesized references could be achieved; done means repeated unchanged deployments show no differences.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100