Node.js で AWS Lambda 動作環境のシステム情報を調べる

## 概要
- Node.js のプログラムを AWS Lambda で動かして event オブジェクト、context オブジェクト、環境変数などを出力する

## 作成する AWS Lambda 関数の情報

- 関数名: myNodeJsSystemInfo
- ランタイム: Node.js 10.x

## 関数コードの項目に入力するソースコード

```javascript
exports.handler = async (event, context) => {
    return {
        event: event,
        context: context,
        process: {
            argv: process.argv,
            config: process.config,
            env: process.env,
            execArgv: process.execArgv,
            execPath: process.execPath,
            title: process.title,
            version: process.version,
            versions: process.versions,
        }
    };
};
```

## テストの入力値

```json
{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}
```

## 実行結果の例

```json
{
  "event": {
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
  },
  "context": {
    "callbackWaitsForEmptyEventLoop": true,
    "functionVersion": "$LATEST",
    "functionName": "myNodeJsSystemInfo",
    "memoryLimitInMB": "128",
    "logGroupName": "/aws/lambda/myNodeJsSystemInfo",
    "logStreamName": "2019/09/03/[$LATEST]XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "invokedFunctionArn": "arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:myNodeJsSystemInfo",
    "awsRequestId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  },
  "process": {
    "argv": [
      "/var/lang/bin/node",
      "/var/runtime/index.js"
    ],
    "config": {
      "target_defaults": {
        "cflags": [],
        "default_configuration": "Release",
        "defines": [],
        "include_dirs": [],
        "libraries": []
      },
      "variables": {
        "asan": 0,
        "build_v8_with_gn": false,
        "coverage": false,
        "debug_nghttp2": false,
        "enable_lto": false,
        "enable_pgo_generate": false,
        "enable_pgo_use": false,
        "force_dynamic_crt": 0,
        "gas_version": "2.29",
        "host_arch": "x64",
        "icu_data_in": "../../deps/icu-small/source/data/in/icudt64l.dat",
        "icu_endianness": "l",
        "icu_gyp_path": "tools/icu/icu-generic.gyp",
        "icu_locales": "en,root",
        "icu_path": "deps/icu-small",
        "icu_small": true,
        "icu_ver_major": "64",
        "llvm_version": 0,
        "node_byteorder": "little",
        "node_debug_lib": false,
        "node_enable_d8": false,
        "node_enable_v8_vtunejit": false,
        "node_install_npm": true,
        "node_module_version": 64,
        "node_no_browser_globals": false,
        "node_prefix": "/var/lang",
        "node_release_urlbase": "",
        "node_shared": false,
        "node_shared_cares": false,
        "node_shared_http_parser": false,
        "node_shared_libuv": false,
        "node_shared_nghttp2": false,
        "node_shared_openssl": false,
        "node_shared_zlib": false,
        "node_tag": "",
        "node_target_type": "executable",
        "node_use_bundled_v8": true,
        "node_use_dtrace": false,
        "node_use_etw": false,
        "node_use_large_pages": false,
        "node_use_openssl": true,
        "node_use_pch": false,
        "node_use_perfctr": false,
        "node_use_v8_platform": true,
        "node_with_ltcg": false,
        "node_without_node_options": false,
        "openssl_fips": "",
        "openssl_no_asm": 0,
        "shlib_suffix": "so.64",
        "target_arch": "x64",
        "v8_enable_gdbjit": 0,
        "v8_enable_i18n_support": 1,
        "v8_enable_inspector": 1,
        "v8_no_strict_aliasing": 1,
        "v8_optimized_debug": 0,
        "v8_promise_internal_field_count": 1,
        "v8_random_seed": 0,
        "v8_trace_maps": 0,
        "v8_typed_array_max_size_in_heap": 0,
        "v8_use_snapshot": true,
        "want_separate_host_toolset": 0
      }
    },
    "env": {
      "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST",
      "AWS_SESSION_TOKEN": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/myNodeJsSystemInfo",
      "LAMBDA_TASK_ROOT": "/var/task",
      "LD_LIBRARY_PATH": "/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib",
      "AWS_LAMBDA_RUNTIME_API": "127.0.0.1:9001",
      "AWS_LAMBDA_LOG_STREAM_NAME": "2019/09/03/[$LATEST]XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "AWS_EXECUTION_ENV": "AWS_Lambda_nodejs10.x",
      "AWS_XRAY_DAEMON_ADDRESS": "XXX.XXX.XX.X:2000",
      "AWS_LAMBDA_FUNCTION_NAME": "myNodeJsSystemInfo",
      "PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin",
      "AWS_DEFAULT_REGION": "ap-northeast-1",
      "PWD": "/var/task",
      "AWS_SECRET_ACCESS_KEY": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "LAMBDA_RUNTIME_DIR": "/var/runtime",
      "LANG": "en_US.UTF-8",
      "NODE_PATH": "/opt/nodejs/node10/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules",
      "AWS_REGION": "ap-northeast-1",
      "TZ": ":UTC",
      "AWS_ACCESS_KEY_ID": "XXXXXXXXXXXXXXXXXXXX",
      "SHLVL": "0",
      "_AWS_XRAY_DAEMON_ADDRESS": "XXX.XXX.XX.X",
      "_AWS_XRAY_DAEMON_PORT": "2000",
      "AWS_XRAY_CONTEXT_MISSING": "LOG_ERROR",
      "_HANDLER": "index.handler",
      "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "128",
      "_X_AMZN_TRACE_ID": "Root=1-XXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX;Parent=XXXXXXXXXXXXXXXX;Sampled=0"
    },
    "execArgv": [
      "--expose-gc",
      "--max-http-header-size",
      "81920",
      "--max-semi-space-size=6",
      "--max-old-space-size=116"
    ],
    "execPath": "/var/lang/bin/node",
    "title": "/var/lang/bin/node",
    "version": "v10.16.3",
    "versions": {
      "http_parser": "2.8.0",
      "node": "10.16.3",
      "v8": "6.8.275.32-node.54",
      "uv": "1.28.0",
      "zlib": "1.2.11",
      "brotli": "1.0.7",
      "ares": "1.15.0",
      "modules": "64",
      "nghttp2": "1.39.2",
      "napi": "4",
      "openssl": "1.1.1c",
      "icu": "64.2",
      "unicode": "12.1",
      "cldr": "35.1",
      "tz": "2019a"
    }
  }
}
```

## 参考資料
- [Node\.js の AWS Lambda 関数ハンドラー \- AWS Lambda](https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/nodejs-prog-model-handler.html)
- [Process \| Node\.js v10\.16\.3 Documentation](https://nodejs.org/docs/latest-v10.x/api/process.html)
- [AWS Lambda \+ Node\.js で Hello World \- Qiita](https://qiita.com/niwasawa/items/e07f29048603281a9ed1)
- [Java で AWS Lambda 動作環境のシステム情報を調べる \- Qiita](https://qiita.com/niwasawa/items/26bf17c21b3a7f2833f0)