aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code

Home Page:https://aws.amazon.com/cdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws-stepfuntions: ResultWriter support for bucket and prefix JSONPath

ReservedDeveloper opened this issue · comments

Describe the feature

Currently, the CDK generates the following parameter output for ResultWriter:

"ResultWriter" {
  "Resource": "arn:aws:states:::s3:putObject",
  "Parameters": {
    "Bucket": "my-bucket",
    "Prefix": "my-prefix",
  }
}

However, when browsing the State Machine GUI, there is an option to specify bucket & prefix via JSONPath at runtime, which generates the following

"ResultWriter" {
  "Resource": "arn:aws:states:::s3:putObject",
  "Parameters": {
    "Bucket.$": "$.my_bucket_path",
    "Prefix.$": "$.my_prefix_path",
  }
}

Use Case

Would like to be able to leverage the path varieties for giving a state-driven prefix to make it easier for filtering per-run results

Proposed Solution

I would anticipate this would have a very similar approach to the recently submitted #30836 due to similar constraints around existing bucket and prefix parameters, and similar area of impact.

Other Information

No response

Acknowledgements

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

CDK version used

2.151.0

Environment details (OS name and version, etc.)

Any

Looking at the state machine GUI for Export location, when option Get bucket name and prefix at runtime from state input for an S3 bucket is selected, has textbox for specifying S3 bucket and prefix with placeholders $.myStateInput.key and $.myStateInput.Prefix respectively:
Screenshot 2024-08-23 at 1 54 48 PM

Specifying these values renders the following JSON in code:

...
      "ResultWriter": {
        "Resource": "arn:aws:states:::s3:putObject",
        "Parameters": {
          "Bucket.$": "$.myStateInput.key",
          "Prefix.$": "$.myStateInput.Prefix"
        }
      }
...

@ReservedDeveloper Feel free to contribute PR which could be reviewed by the team.