elaspog
elaspog

Reputation: 1699

How to define parameters for AWS Step Function from CDK v2 in python?

I want to define the value of Parameters property of a given task of a step function for processing the input and output according to this documentation: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html

I've found all the other properties for LambdaInvoke method from the document linked below (InputPath, ResultPath, ResultSelector, OutputPath), except the Parameters property. https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_stepfunctions_tasks/LambdaInvoke.html

my_lambda_fn = aws_lambda.Function(
    self,
    f"function-{config['name']}",
    ...
}

self.task = tasks.LambdaInvoke(
    self,
    f"lambdainvoke-{config['name']}",
    lambda_function=my_lambda_fn,
    input_path=...,                     # <- I can define this
    result_path =...,                   # <- I can define this
    result_selector =...,               # <- I can define this
    output_path =...,                   # <- I can define this
    parameters=...,                     # <- Why I can't define this???
    
)

Is it even possible to define this from CDK? Or my whole concept is wrong about this? If it's possible, how should I define this properly? (I haven't found any working example to this)

Upvotes: 2

Views: 2095

Answers (1)

JD D
JD D

Reputation: 8097

What is your goal with using Parameters?

If you want to define what is passed to your Lambda function, use the payload parameter of the LambdaInvoke definition. payload is one of the many parameters to the LambdaInvoke task definition and CDK makes it so that these parameters are part of the function definition and the generic Parameters parameter built and passed behind the scenes.

I believe the "Input and Output Processing in Step Functions" documentation you are reading about step function is fairly generic and the "Parameters" concept is just saying that each type of step function task can expect/accept a set of parameters.

If you look through the other task types in the CDK library, such as ECS Run Task, they each have their own unique set of parameters.

Hope that makes sense and adds some clarity.

Upvotes: 2

Related Questions