Command Line Options


Sparta provides a Main function that transforms a set of lambda functions into an application. This function should be called from your application’s package main as in:

var lambdaFunctions []*sparta.LambdaAWSInfo
lambdaFunctions = append(lambdaFunctions, lambdaFn)
err := sparta.Main("SpartaHelloWorld",
  fmt.Sprintf("Test HelloWorld resource command"),

A compiled application provides several command line options which are available by providing the -h/--help option as in:

$ ./SpartaHelloWorld --help

Test HelloWorld resource command

  SpartaHelloWorld [command]

Available Commands:
  version     Sparta framework version
  provision   Provision service
  delete      Delete service
  execute     Execute
  describe    Describe service
  explore     Interactively explore service

  -l, --level string   Log level [panic, fatal, error, warn, info, debug]' (default "info")
  -n, --noop           Dry-run behavior only (do not perform mutations)

Use "SpartaHelloWorld [command] --help" for more information about a command.

It’s also possible to add custom flags and/or custom commands to extend your application’s behavior.

Standard Commands


The provision option is the verb most likely to be used during development. It provisions the Sparta application to AWS Lambda.


This simply deletes the stack (if present). Attempting to delete a non-empty stack is not treated as an error.


The describe command line option produces an HTML summary (see graph.html for an example) of your Sparta service.

The report also includes the automatically generated CloudFormation template which can be helpful when diagnosing provisioning errors.


The execute option is typically used when the compiled application is launched in the AWS Lambda environment. It starts up an HTTP listener to which the NodeJS proxing tier forwards requests.


The explore option creates a localhost server to allow Sparta lambda functions to be tested locally.

NOTE: API Gateway mapping templates are not currently supported.


The version option is a diagnostic command that prints the version of the Sparta framework embedded in the application.