Visit gosparta.io for complete documentation.
Sparta takes a set of golang functions and automatically provisions them in AWS Lambda as a logical unit.
AWS lambda functions are defined as standard HandlerFunc.ServeHTTP functions as in
type myHelloWorldFunction func(w http.ResponseWriter, r *http.Request) {
...
}where
w: The ResponseWriter used to return the lambda responser: The arbitrary event data provided to the function.
The http.Request instance also includes context scoped values as in:
*logrus.Logger: A request scoped logger_ := r.Context().Value(sparta.ContextKeyLogger).(*logrus.Logger)
- *sparta.LambdaContext : AWS lambda context parameters
lambdaContext, _ := r.Context().Value(sparta.ContextKeyLambdaContext).(*sparta.LambdaContext)
Consumers define a set of lambda functions and provide them to Sparta to create a self-documentating, self-deploying AWS Lambda binary:
lambdaFn := sparta.HandleAWSLambda("Hello World",
http.HandlerFunc(myHelloWorldFunction),
sparta.IAMRoleDefinition{})
var lambdaFunctions []*sparta.LambdaAWSInfo
lambdaFunctions = append(lambdaFunctions, lambdaFn)
err := sparta.Main("MyHelloWorldStack",
"Simple Sparta application that demonstrates core functionality",
lambdaFunctions,
nil,
nil)Given a set of registered golang functions, Sparta will:
- Either verify or provision the defined IAM roles
- Build a deployable application via
Provision() - Zip the contents and associated proxying logic
- Dynamically create a CloudFormation template to either create or update the service state.
- Optionally:
- Register with S3 and SNS for push source configuration
- Provision an API Gateway service to make your functions publicly available
- Provision an S3 static website
Visit gosparta.io for complete documentation.
See the Limitations page for the most up-to-date information.
Thanks to all Sparta contributors (alphabetical)
- Kyle Anderson
- James Brook
- Ryan Brown
- sdbeard
- Scott Raine
- Paul Seiffert
- Thom Shutt