'AWS StepFunctions: prefix input string
Using TypeScript and CDK, how do I define a task that prefixes one of the fields of the input and keeps the rest unchanged?
Input:
{
"field1": "foo",
"field2": "bar"
}
Expected output:
{
"field1": "baz_foo",
"field2": "bar"
}
Solution 1:[1]
This can be done with a Pass task and intrinsic function States.Format.
const addPrefix = new sfn.Pass(this, 'AddPrefix', {
parameters: {
'field1.$': "States.Format('{}{}', 'baz_', $.field1)",
'field2.$': '$.field2',
},
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RĂ¼diger Schulz |
