aws-cdk-lib.aws_stepfunctions.Credentials

interface Credentials

LanguageType name
.NETAmazon.CDK.AWS.StepFunctions.Credentials
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#Credentials
Javasoftware.amazon.awscdk.services.stepfunctions.Credentials
Pythonaws_cdk.aws_stepfunctions.Credentials
TypeScript (source)aws-cdk-lib » aws_stepfunctions » Credentials

Specifies a target role assumed by the State Machine's execution role for invoking the task's resource.

See also: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html#task-state-fields

Example

import * as lambda from 'aws-cdk-lib/aws-lambda';

declare const submitLambda: lambda.Function;
declare const iamRole: iam.Role;

// use a fixed role for all task invocations
const role = sfn.TaskRole.fromRole(iamRole);
// or use a json expression to resolve the role at runtime based on task inputs
//const role = sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn');

const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', {
  lambdaFunction: submitLambda,
  outputPath: '$.Payload',
  // use credentials
  credentials: { role },
});

Properties

NameTypeDescription
roleTaskRoleThe role to be assumed for executing the Task.

role

Type: TaskRole

The role to be assumed for executing the Task.