How to change retention time / period on AWS Step Functions

Viewed 711

By default the retention time for an AWS Step Function is 90 days.

https://docs.aws.amazon.com/step-functions/latest/dg/limits.html

Both execution input and execution output that results from executing a step function will then be retained and accesable for 90 days.

Let's say you have to obey a policy where you may only save such information for one day.

How could you than change the retention time to one day?

1 Answers

You can't change the retention time for execution history, but if these logs are important and should not be accessed by some resources, you can explicitly add deny policy for those resources:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "1",
            "Effect": "Deny",
            "Action": "states:GetExecutionHistory",
            "Resource": "arn:aws:states:REGION:ACCTID:execution:*:*"
        }
    ]
}

You may update it for specific state machine like this:

"Resource": "arn:aws:states:REGION:ACCTID:execution:STATEMACHINE:*"
Related