Amplify-cli: Pass parameters to lambda method in command line without event.json

Created on 7 Aug 2019  路  1Comment  路  Source: aws-amplify/amplify-cli

Is your feature request related to a problem? Please describe.
My use case is I need to create some utility scripts that do some admin on our backend (e.g. add users to cognito groups, backfill data, dump data from dynamo, etc..). I'm currently doing these via the function category, even though I only plan to run these functions locally and I don't care about deployment.

This is equivalent scenario to the reason why rails has rake tasks.

Functions are great, but I have a scenario now where I want to pass parameters to a function via the command line without having to create a new event.json since these parameters are a one-off thing.

Describe the solution you'd like
Pass "context" or "event" via command line without having to create a file.

Describe alternatives you've considered
Hardcode parameter values in the index.js and change them every time function is executed or create a specific event.json

Additional context
I basically want something equivalent to rake tasks in rails - a series of adhoc tasks that an admin might need to run on the backend via command line. The tasks usually will not be run by the app itself.

feature-request functions

Most helpful comment

Please note, as originally mentioned in https://github.com/aws-amplify/amplify-cli/issues/1975

Besides passing in an event on the CLI, there are two other issues mentioned in my original issue that I feel warrant attention:

  1. Allow me to pass _all_ of the arguments (name of function, src file, handler name, and event) on the CLI invocation

  2. Give me sane defaults for all items in point one above where it makes sense

>All comments

Please note, as originally mentioned in https://github.com/aws-amplify/amplify-cli/issues/1975

Besides passing in an event on the CLI, there are two other issues mentioned in my original issue that I feel warrant attention:

  1. Allow me to pass _all_ of the arguments (name of function, src file, handler name, and event) on the CLI invocation

  2. Give me sane defaults for all items in point one above where it makes sense

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rehos picture rehos  路  3Comments

nicksmithr picture nicksmithr  路  3Comments

jexh picture jexh  路  3Comments

onlybakam picture onlybakam  路  3Comments

kstro21 picture kstro21  路  3Comments