From f0c9a59cc539e16655c719d3c785974c0a9fe7ec Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Sat, 16 Sep 2023 21:34:01 +0200 Subject: [PATCH] Docs: CLI commands --- docs/default/cli-commands.mdx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/default/cli-commands.mdx b/docs/default/cli-commands.mdx index 4a7c8be29..db8b8dc24 100644 --- a/docs/default/cli-commands.mdx +++ b/docs/default/cli-commands.mdx @@ -1 +1,28 @@ # CLI commands + +We can run CLI commands and scripts on AWS Lambda by deploying a "console" function with `serverless.yml`. + +```yml +functions: + cli: + handler: the-php-script-to-run.php + runtime: php-81-console +``` + +The function uses the [Console runtime](../runtimes/console.mdx). + +To execute the script on Lambda, run the command below: + +```bash +serverless bref:cli +``` + +We can also pass arguments to the script: + +```bash +serverless bref:cli --args="extra command line arguments and options" +``` + +Our script will be invoked inside AWS Lambda and the result will be printed to the console. + +To learn more, read [the "Console" guide](../runtimes/console.mdx).