I know that it is possible to pass parameters to a Java program running on AWS Lambda in order to test it. But I do not know how to pass those parameters if this program gets called by a schedule event.
Does anyone know if this is possible? If yes, how? I was not able to find anything about it.
Thanks in advance
You can store parameter data as Lambda environment variables as part of the function's version-specific configuration.
Step Functions paths use JsonPath syntax. To specify that a parameter use a path to reference a JSON node in the input, end the parameter name with . $ . For example, if you have text in your state input in a node named message , you could pass that to a parameter by referencing the input JSON with a path.
The lambda function always generates 0, and it doesn't care about the input argument, so the input argument can be represented using _ .
You can create a CloudWatch rule as a schedule and configure target's input as a constant json value:
CloudWatch -> Events -> Rules -> Schedule -> Targers
Set Configure input as Сonstant (JSON text) and pass any valid json-data there.
In Lambda you can access constant input as an input object.
You could leverage the environment variables from the lambda configuration. Then you read them on your Java program with:
System.getenv("VAR_NAME")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With