Running CDKTF on AWS Lambda

Hi,

I’m attempting to run cdktf synth on an AWS Lambda function, targeting the writeable tmp folder for the output as all other folders on the Lambda are read-only. However, running the command throws an error where cdktf seemingly attempts to write something to the home folder : “Error: EROFS: read-only file system, mkdir ‘/home/sbx_user1051’”.

Is this expected behavior?

The full command: cdktf synth --output ~/tmp/cdktf/cdktf.out

Hi @nbaju1 :wave:

This is probably the caching of the version check that’s happening. It writes to the CDKTF_HOME directory (which by default is ~/.cdktf if I remember correctly). You can either set that directory to a writable one or try disabling the version check via the env var DISABLE_VERSION_CHECK=true.

– Ansgar

Thanks, @ansgarm!

I ended up disabling CDKTF_DISABLE_PLUGIN_CACHE_ENV and setting CDKTF_HOME to the writable tmp directory on the Lambda, which did the trick.