Problem:
Step Function Executions are retained indefinetely. This causes a possible GDPR issue when we use Step Functions for handling sensitive customer information.
I've noticed we can organise the Log Levels, but this does not hide passed data in the execution, nor offer the opportunity to set a TTL on the Executions.
CDK Code:
this.stateMachine= new StateMachine(this, "stateMachine", { definition: definition, logs: { destination: logGroup, level: LogLevel.OFF } });
How can I only store Step Function Executions for a specific period of time?
Step Functions does not retain execution indefinitely. It will retain Execution History for Standard Workflows for 90 days after an execution completes. It will then be automatically deleted. Express Workflows do not store this data by default.
If you use the optional configuration to emit this data CloudWatch Logs (for either Standard or Express) then you manage the lifecycle in CloudWatch logs.