How do I store variables in S3 and access them from a KS test script?

You can try using AWS SDK for Java in Katalon Studio, though there could be a lot of hurdles for you to overcome. The following post shows one of the hurdles I encountered previously.