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:

$ go run main.go --help
Simple Sparta application that demonstrates core functionality

  main [command]

Available Commands:
  delete      Delete service
  describe    Describe service
  execute     Execute
  explore     Interactively explore service
  help        Help about any command
  provision   Provision service
  version     Sparta framework version

  -f, --format string    Log format [text, json] (default "text")
  -h, --help             help for main
      --ldflags string   Go linker string definition flags (
  -l, --level string     Log level [panic, fatal, error, warn, info, debug] (default "info")
  -n, --noop             Dry-run behavior only (do not perform mutations)
  -t, --tags string      Optional build tags for conditional compilation

Use "main [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.