You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-stepfunctions/README.md
+28
Original file line number
Diff line number
Diff line change
@@ -577,6 +577,34 @@ const definition = sfn.Chain
577
577
// ...
578
578
```
579
579
580
+
## Task Credentials
581
+
582
+
Tasks are executed using the State Machine's execution role. In some cases, e.g. cross-account access, an IAM role can be assumed by the State Machine's execution role to provide access to the resource.
583
+
This can be achieved by providing the optional `credentials` property which allows using a fixed role or a json expression to resolve the role at runtime from the task's inputs.
584
+
585
+
```ts
586
+
import*asiamfrom'@aws-cdk/aws-iam';
587
+
import*aslambdafrom'@aws-cdk/aws-lambda';
588
+
589
+
declareconst submitLambda:lambda.Function;
590
+
declareconst iamRole:iam.Role;
591
+
592
+
// use a fixed role for all task invocations
593
+
const role =sfn.TaskRole.fromRole(iamRole);
594
+
// or use a json expression to resolve the role at runtime based on task inputs
595
+
//const role = sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn');
0 commit comments