title: How to pass parameter to event object aws lambda functions in nodejs 8.10v
body: <p>I am working project there we are creating a serverless architecture for handle computation task. How to pass parameters to event object in aws lambda function.</p>
  
  <p>Is there any reference link, if any please suggest.</p>
  
  <p><strong>index.js - handler function of lambda</strong></p>
  
  <pre><code>exports.handler = (event, context, callback) =&gt; {
    context.callbackWaitsForEmptyEventLoop = false;
    const mysql = require("mysql");
    const pool = mysql.createPool({
      host: "test_db.xxxxxxxxxxx.us-east-2.rds.amazonaws.com",
      user: "root",
      password: "xxxxxxxx",
      database: "test_db",
      port: 3306
    });
  
    pool.getConnection((err, connection) =&gt; {
      if (err) throw err;
  
      // const { fund_name, returns, aum, rating, expense_ratio } = event.body; // BODY PARAMETER REMAINING
      const randomNumber = () =&gt; Math.random()*10+1;
      const fund_name = 'example';
      const returns = randomNumber();
      const aum = randomNumber();
      const rating = randomNumber();
      const expense_ratio = randomNumber();
  
      if (fund_name &amp;&amp; returns &amp;&amp; aum &amp;&amp; rating &amp;&amp; expense_ratio) {
        pool.getConnection((err, connection) =&gt; {
          if (err) {
            throw err;
          }
  
          const query = `INSERT INTO mutual_fund_tb(fund_name, returns, aum, rating, expense_ratio) VALUES ('${fund_name}', '${returns}', '${aum}', '${rating}', '${expense_ratio}')`;
          connection.query(query, (err, results, fields) =&gt; {
            if (err) {
              throw err;
            }
  
            if (results.affectedRows === 1) {
              const response = {
                data: {...event.body},
                message: "Data successfully inserted",
                status: "ok"
              };
              callback(null, response);
            } else {
              const response = {
                data: {},
                message: "Data unable to insert into database.",
                status: "failed"
              };
              callback(null, response);
            }
          });
        });
      } else {
        const response = {
          data: {},
          message: "Invalid arguments passed. Please pass valid arguments",
          status: "failed"
        };
        callback(null, response);
      }
    });
  };
  </code></pre>