0

I have StaticClass.variable that is written to by one state, and a different state accesses it later. However, once I get to the next state StaticClass is no longer initialized.

Is there any work around? Passing only data through JSON is limited, I want to pass object instances as well.

Sophia Tao
  • 27
  • 3

1 Answers1

0

Static variables are initialized when a new container is created to run your Lambda (also called ‘cold start’).

You should never assume that a static variable was already initialized, though it is a good practice to avoid re-initialization by saving variables as static.

If the you need to pass information between step functions you should do it using the AWS Step Functions interface (to pass complete objects, you should use serialization such as JSON)

Ronyis
  • 1,803
  • 16
  • 17