LoginSignup
1
0

More than 3 years have passed since last update.

【備忘録】AWS Lambda関数でLambda関数を呼ぶ invoke

Last updated at Posted at 2020-04-21

Lambda関数から別のLambhda関数を呼びに行きたい時ってありますよね!

そんな時に使える方法を備忘録として残します。

公式ドキュメント該当ページ

呼び出す側のLambda関数 main

index.js
const AWS = require('aws-sdk')
const lambda = new AWS.Lambda()

let params = {
              FunctionName: `invoked`,
              InvocationType: 'Event',
              Payload: JSON.stringify({
                id: "xxxxxxxxxx",
                message: "xxxx"
              })
            }
            console.log(params)
            // 呼び出される側のLambda関数を実行する
            lambda.invoke(params).promise()

呼び出される側の関数 invoked

index.js.js
exports.handler = async (event, context) => {
console.log(event)
 }

参考になるページ

AWS Lambda 関数から 別の Lambda 関数を呼び出す方法

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0