How to Set JVM Arguments (VM Options) in AWS Lambda
We can easily set JVM arguments (e.g. system properties) in our AWS Lambda function through a single environment variable.
Let’s say we have a JAR file that we want to run within an AWS Lambda function.
In IntelliJ, we might use
VM Options to specify JVM attributes such as stack/heap memory allocation, system properties, GC flags, etc.
Suppose our project specifies two system properties in
These may be properties accessed through
Set properties using
We can use the
JAVA_TOOL_OPTIONS environment variable to specify properties we would normally specify in the command line, or in IntelliJ’s
JAVA_TOOL_OPTIONSenvironment variable augments the command line particularly for environments in which a command line is not accessible (like AWS Lambdas).
JAVA_TOOL_OPTIONSmakes it possible to add these properties independent of the way the JVM is started.
In our AWS Lambda
Configuration tab, we can modify
For the key, we can use
For the value, we can use