Read Time: 1 min

How to: Clean the Contents of AWS Step Function Path Variables

AWS Step Functions provides serverless flow orchestration capability.


Normally you would execute a flow orchestration once per transaction, but sometimes you need to iterate through many transactions in a loop as part of your orchestration. In this case where you iterate in sequence (and not in parallel) you sometimes need to ensure the path variables aren’t re-used i.e. are ‘clean’ between iterations.

This happened to me recently when the target system I was working with could only handle one transaction at a time, not a typical scenario in an enterprise IT environment.


Set a “pass” type task in the step function flow, and add the path variables you want to keep under “parameters” section as follows:

“CleanVars”: {
“Type”: “Pass”,
“InputPath”: “$”,
“Parameters”: {
“FileName.$”: “$.FileName”,
“BucketName.$”: “$.BucketName”,
“data.$”: “$.data”,
“iterator.$”: “$.iterator”
“ResultPath”: “$”,
“Next”: “NextTask”

Author Details
Riaan Ingram
Riaan Ingram
Principal Consultant (Architecture & Integration)
Riaan is a Principal Consultant with over 18 years’ IT design and development experience. Riaan has a strong technical background and specialises in developing and integrating enterprise business solutions. Riaan has in depth knowledge of integration as well as cloud patterns & technologies and is an expert in the planning, design and implementation of API first integration approaches.
Send Email
Got an enquiry? Intelligent Pathways wants to hear from you.
  • This field is for validation purposes and should be left unchanged.