aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

stepfunctions: support dynamic bucket in Map ItemReader

Open gael-ft opened this issue 1 year ago • 1 comments

Describe the feature

Goal is to allow using JsonPath for IItemReader properties when defining a Map.

For now, interface IItemReader defines bucket field as type IBucket.

But from a CFN perspective we only need a bucket name. Using IBucket blocks users from using JsonPath as dynamic bucket name.

Example:

const distributedMap = new sfn.DistributedMap(this, 'Distributed Map State', {
  itemReader: new sfn.S3JsonItemReader({
    bucket: JsonPath.stringAt('$.myBucket'),
    key: JsonPath.stringAt('$.myKey'),
  }),
  // ...
});
"ItemReader": {
    "Resource": "arn:aws:states:::s3:getObject",
    "ReaderConfig": {
        "InputType": "JSON"
    },
    "Parameters": {
        "Bucket.$": "$.myBucket",
        "Key.$": "$.myKey"
    }
}

Current CDK implementation

Use Case

Using the provided construct instead of a CustomState for DistributedMap.

Proposed Solution

Simply using string instead of IBucket (possibly accepting both if necessary ?)

Other Information

No response

Acknowledgements

  • [X] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

CDK version used

2.162.1

Environment details (OS name and version, etc.)

macOS 13.5

gael-ft avatar Oct 18 '24 12:10 gael-ft

Hi @gael-ft , thanks for reaching out.

I found a previous similar issue reg the support of Dynamic bucket in Map ItemReader - https://github.com/aws/aws-cdk/issues/29409 and PR seems to be merged 4 days ago -https://github.com/aws/aws-cdk/pull/31619

Please let me know if that works as per your usecase.

khushail avatar Oct 18 '24 20:10 khushail

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.

github-actions[bot] avatar Oct 21 '24 00:10 github-actions[bot]

Hello @khushail,

Ok thanks for linking, didn't find it ... Looks to be release with in v2.163.

gael-ft avatar Oct 25 '24 07:10 gael-ft

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.

github-actions[bot] avatar Oct 25 '24 07:10 github-actions[bot]