Step Function: Dynamic input to ItemReader

0

I am working on a use case where I need to process a JSON file stored on S3 through a map state. Here is how I am passing the bucket name and Key to ItemReader:

"ItemReader": {
              "Resource": "arn:aws:states:::s3:getObject",
              "ReaderConfig": {
                "InputType": "JSON"
              },
              "Parameters": {
                "Bucket": "bucket-name",
                "Key.$": "$.StudyID"
              }
 }

The bucket name is static (can be sourced from state's input if necessary) and Key varies (sourced from state's input).

Question - Can we add a static prefix to the key? Like "Key.$": "static-prefix/$.StudyID". I have tested this but doesn't work. Is there any alternate solution to this?

Kamlesh
質問済み 9ヶ月前672ビュー
1回答
0

Hi.

Try using the States.Format Intrinsic function, it give you the possibility to manipulate the string.

"Key.$": "States.Format('static-prefix/{}.', $.StudyID)"

See the documentation for more information

profile picture
エキスパート
回答済み 9ヶ月前
profile picture
エキスパート
レビュー済み 9ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ