Skip to content

Instantly share code, notes, and snippets.

@ryparker
Forked from seeebiii/LambdaConstants.java
Created July 28, 2020 23:06
Show Gist options
  • Save ryparker/39364c5cf882509890d7fa95f8850785 to your computer and use it in GitHub Desktop.
Save ryparker/39364c5cf882509890d7fa95f8850785 to your computer and use it in GitHub Desktop.
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
/**
* Contains the path to your Lambda function code.
*/
const LAMBDA_TASK_ROOT = process.env.LAMBDA_TASK_ROOT;
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10
*/
const AWS_EXECUTION_ENV = process.env.AWS_EXECUTION_ENV;
/**
* Restricted to Lambda runtime-related artifacts. For example the aws-sdk for Node.js and boto3 for Python can be found under this path.
*/
const LAMBDA_RUNTIME_DIR = process.env.LAMBDA_RUNTIME_DIR;
/**
* The AWS region where the Lambda function is executed.
*/
const AWS_REGION = process.env.AWS_REGION;
/**
* The AWS region where the Lambda function is executed.
*/
const AWS_DEFAULT_REGION = process.env.AWS_DEFAULT_REGION;
/**
* The name of Amazon CloudWatch Logs group where log streams containing your Lambda function logs are created.
*/
const AWS_LAMBDA_LOG_GROUP_NAME = process.env.AWS_LAMBDA_LOG_GROUP_NAME;
/**
* The Amazon CloudWatch Logs streams containing your Lambda function logs.
*/
const AWS_LAMBDA_LOG_STREAM_NAME = process.env.AWS_LAMBDA_LOG_STREAM_NAME;
/**
* The name of the Lambda function.
*/
const AWS_LAMBDA_FUNCTION_NAME = process.env.AWS_LAMBDA_FUNCTION_NAME;
/**
* The size of the Lambda function in MB.
*/
const AWS_LAMBDA_FUNCTION_MEMORY_SIZE = process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE;
/**
* The version of the Lambda function.
*/
const AWS_LAMBDA_FUNCTION_VERSION = process.env.AWS_LAMBDA_FUNCTION_VERSION;
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
const AWS_ACCESS_KEY = process.env.AWS_ACCESS_KEY;
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
const AWS_SECRET_KEY = process.env.AWS_SECRET_KEY;
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
const AWS_SESSION_TOKEN = process.env.AWS_SESSION_TOKEN;
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
const AWS_SECURITY_TOKEN = process.env.AWS_SECURITY_TOKEN;
/**
* Contains /usr/local/bin, /usr/bin or /bin for running executables.
*/
const PATH = process.env.PATH;
/**
* Set to en_US.UTF-8. This is the Locale of the runtime.
*/
const LANG = process.env.LANG;
/**
* Contains /lib64, /usr/lib64, LAMBDA_TASK_ROOT, LAMBDA_TASK_ROOT/lib. Used to store helper libraries and function code.
*/
const LD_LIBRARY_PATH = process.env.LD_LIBRARY_PATH;
/**
* Set for the Node.js runtime. It contains LAMBDA_RUNTIME_DIR, LAMBDA_RUNTIME_DIR/node_modules, LAMBDA_TASK_ROOT.
*/
const NODE_PATH = process.env.NODE_PATH;
/**
* The current local time. Defaults to :UTC.
*/
const TZ = process.env.TZ;
module.exports = {
LAMBDA_TASK_ROOT,
AWS_EXECUTION_ENV,
LAMBDA_RUNTIME_DIR,
AWS_REGION,
AWS_DEFAULT_REGION,
AWS_LAMBDA_LOG_GROUP_NAME,
AWS_LAMBDA_LOG_STREAM_NAME,
AWS_LAMBDA_FUNCTION_NAME,
AWS_LAMBDA_FUNCTION_MEMORY_SIZE,
AWS_LAMBDA_FUNCTION_VERSION,
AWS_ACCESS_KEY,
AWS_ACCESS_KEY_ID,
AWS_SECRET_KEY,
AWS_SECRET_ACCESS_KEY,
AWS_SESSION_TOKEN,
AWS_SECURITY_TOKEN,
PATH,
LANG,
LD_LIBRARY_PATH,
NODE_PATH,
TZ
};
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10
*/
public static final String AWS_EXECUTION_ENV = System.getenv("AWS_EXECUTION_ENV");
/**
* Restricted to Lambda runtime-related artifacts. For example the aws-sdk for Node.js and boto3 for Python can be found under this
* path.
*/
public static final String LAMBDA_RUNTIME_DIR = System.getenv("LAMBDA_RUNTIME_DIR");
/**
* The AWS region where the Lambda function is executed.
*/
public static final String AWS_REGION = System.getenv("AWS_REGION");
/**
* The AWS region where the Lambda function is executed.
*/
public static final String AWS_DEFAULT_REGION = System.getenv("AWS_DEFAULT_REGION");
/**
* The name of Amazon CloudWatch Logs group where log streams containing your Lambda function logs are created.
*/
public static final String AWS_LAMBDA_LOG_GROUP_NAME = System.getenv("AWS_LAMBDA_LOG_GROUP_NAME");
/**
* The Amazon CloudWatch Logs streams containing your Lambda function logs.
*/
public static final String AWS_LAMBDA_LOG_STREAM_NAME = System.getenv("AWS_LAMBDA_LOG_STREAM_NAME");
/**
* The name of the Lambda function.
*/
public static final String AWS_LAMBDA_FUNCTION_NAME = System.getenv("AWS_LAMBDA_FUNCTION_NAME");
/**
* The size of the Lambda function in MB.
*/
public static final String AWS_LAMBDA_FUNCTION_MEMORY_SIZE = System.getenv("AWS_LAMBDA_FUNCTION_MEMORY_SIZE");
/**
* The version of the Lambda function.
*/
public static final String AWS_LAMBDA_FUNCTION_VERSION = System.getenv("AWS_LAMBDA_FUNCTION_VERSION");
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
public static final String AWS_ACCESS_KEY = System.getenv("AWS_ACCESS_KEY");
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
public static final String AWS_ACCESS_KEY_ID = System.getenv("AWS_ACCESS_KEY_ID");
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
public static final String AWS_SECRET_KEY = System.getenv("AWS_SECRET_KEY");
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
public static final String AWS_SECRET_ACCESS_KEY = System.getenv("AWS_SECRET_ACCESS_KEY");
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
public static final String AWS_SESSION_TOKEN = System.getenv("AWS_SESSION_TOKEN");
/**
* The security credentials required to execute the Lambda function, depending on which runtime is used.
* Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
*/
public static final String AWS_SECURITY_TOKEN = System.getenv("AWS_SECURITY_TOKEN");
/**
* Contains /usr/local/bin, /usr/bin or /bin for running executables.
*/
public static final String PATH = System.getenv("PATH");
/**
* Set to en_US.UTF-8. This is the Locale of the runtime.
*/
public static final String LANG = System.getenv("LANG");
/**
* Contains /lib64, /usr/lib64, LAMBDA_TASK_ROOT, LAMBDA_TASK_ROOT/lib. Used to store helper libraries and function code.
*/
public static final String LD_LIBRARY_PATH = System.getenv("LD_LIBRARY_PATH");
/**
* The current local time. Defaults to :UTC.
*/
public static final String TZ = System.getenv("TZ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment