Browse files

Update docs, header formatting

  • Loading branch information...
mweagle committed Dec 12, 2018
1 parent 599c0fe commit b6062da761b9d5ff6e28f9c36b0254943ebc5802
@@ -1,11 +1,12 @@
date: 2016-03-09T19:56:50+01:00
title: API Gateway
post: "&nbsp;<i class='fas fa-fw fa-globe'></i>"
pre: "<b>API Gateway</b>"
alwaysopen: false
weight: 100

# API Gateway

One of the most powerful ways to use AWS Lambda is to make function publicly available over HTTPS. This is accomplished by connecting the AWS Lambda function with the [API Gateway]( In this section we'll start with a simple "echo" example and move on to a lambda function that accepts user parameters and returns an expiring S3 URL.

{{% children %}}
@@ -1,11 +1,11 @@
date: 2016-03-09T19:56:50+01:00
title: Echo Event
title: Echo
weight: 10

To start, we'll create a HTTPS accessible lambda function that simply echoes back the contents of the Lambda event.
The source for this is the [SpartaHTML](
To start, we'll create a HTTPS accessible lambda function that simply echoes back the contents of incoming API Gateway
Lambda event. The source for this is the [SpartaHTML](

For reference, the `helloWorld` function is below.

@@ -14,21 +14,9 @@ import (
awsLambdaEvents ""
spartaAPIGateway ""
func helloWorld(ctx context.Context,
gatewayEvent spartaAWSEvents.APIGatewayRequest) (*spartaAPIGateway.Response, error) {
To return an error back to the client using a standard HTTP status code:
errorResponse := spartaAPIG.NewErrorResponse(http.StatusInternalError,
"Something failed inside here")
return errorResponse, nil
You can also create custom error response types, so long as they
include `"code":HTTP_STATUS_CODE` somewhere in the response body.
This reserved expression is what Sparta uses as a RegExp to determine
the Integration Mapping value
logger, loggerOk := ctx.Value(sparta.ContextKeyLogger).(*logrus.Logger)
if loggerOk {
logger.Info("Hello world structured log message")
@@ -57,7 +45,7 @@ but it will not be [deployed](

## Resource

The next step is to associate a URL path with the `sparta.LambdaAWSInfo` struct that encapsulates the **go** function:
The next step is to associate a URL path with the `sparta.LambdaAWSInfo` struct that represents the **go** function:

func spartaHTMLLambdaFunctions(api *sparta.API) []*sparta.LambdaAWSInfo {
@@ -1,11 +1,13 @@
date: 2016-03-09T19:56:50+01:00
title: Application Customization
post: "&nbsp;<i class='fas fa-fw fa-cog'></i>"
pre: "<b>Application Customization</b>"
alwaysopen: false
weight: 140

# Application Customization

Sparta-based applications use the [Cobra]( package to expose a rich set of command line options. This section describes:

{{% children %}}
@@ -1,11 +1,13 @@
date: 2018-10-13 07:59:27
title: Archetype Constructors
post: "&nbsp;<i class='fas fa-fw fa-flask'></i>"
pre: "<b>Archetype Constructors</b>"
alwaysopen: false
weight: 111

# Archetype Constructors

Sparta's [archetype]( package provides convenience
functions to streamline creating AWS Lambda functions for specific types of [event sources](/reference/eventsources/). See each section for
more details:
@@ -1,11 +1,13 @@
date: 2018-12-01 06:18:10
title: Build-Time Decorators
post: "&nbsp;<i class='fas fa-fw fa-paint-brush'></i>"
pre: "<b>Build-Time Decorators</b>"
chapter: false
weight: 120

# Build-Time Decorators

Sparta uses build-time [decorators]( to annotate the CloudFormation template with
additional functionality.

@@ -1,10 +1,12 @@
date: 2016-03-09T19:56:50+01:00
title: Event Sources
post: "&nbsp;<i class='fas fa-fw fa-cubes'></i>"
pre: "<b>Event Sources</b>"
weight: 110

# Event Sources

The true power of the AWS Lambda architecture is the ability to integrate Lambda execution with other AWS service state transitions. Depending on the service type, state change events are either pushed or transparently polled and used as the input to a Lambda execution.

There are several [event sources]( available. They are grouped into Pull and Push types. Pull based models use `sparta.EventSourceMapping` values, as the trigger configuration is stored in the AWS Lambda service. Push based types use service specific `sparta.*Permission` types to denote the fact that the trigger logic is configured in the remote service.
@@ -1,11 +1,13 @@
date: 2016-03-09T19:56:50+01:00
title: Runtime Interceptors
post: "&nbsp;<i class='fas fa-fw fa-x-ray'></i>"
pre: "<b>Runtime Interceptors</b>"
weight: 130
alwaysopen: false

# Runtime Interceptors

Sparta uses runtime [interceptors]( to hook into
the event handling workflow. Interceptors provide an opportunity to handle concerns (logging, metrics, etc) independent
of core event handling workflow.
@@ -1,10 +1,12 @@
date: 2018-12-01 05:17:18
title: Operations
post: "&nbsp;<i class='fas fa-fw fa-puzzle-piece'></i>"
pre: "<b>Operations</b>"
weight: 499

# Operations

{{< tweet 1067199205930868736 >}}

{{% children %}}
@@ -1,10 +1,12 @@
date: 2018-12-10 21:37:37
title: Step Functions
post: "<i class='fas fa-fw fa-arrows-alt'></i>&nbsp;"
pre: "<b>Step Functions</b>"
weight: 150

# Step Functions

Sparta is designed to facilitate all serverless development strategies. While it provides
an AWS Lambda optimized framework, it is also possible to deploy Lambda-free workflows comprised
of [AWS Step Functions](
@@ -0,0 +1,38 @@
date: 2018-01-22 21:49:38
title: Supporting Packages
weight: 900
alwaysopen: false

The following packages are part of the Sparta ecosystem and can be used in combination
or as standalone in other applications.

## go-cloudcondensor

The [go-cloudcondensor]( package provides
utilities to express CloudFormation templates as a set of `go` functions. Templates
are evaluated and the and the resulting JSON can be integrated into existing
CLI-based workflows.

## go-cloudformation

The [go-cloudformation]( package provides a Go object
model for the official CloudFormation
[JSON Schema](

## SpartaVault

[SpartaVault]( uses KMS to encrypt values into Go types that can be safely
committed to source control. It includes a command line utility that produces an encrypted
set of credentials that are statically compiled into your application.

## ssm-cache

The [ssm-cache]( package provides an expiring cache for
[AWS Systems Manager](
SSM is the preferred service to use for sharing credentials with your service.

## Examples

There are also many Sparta [example repos]( that demonstrate core concepts.
@@ -1,8 +1,7 @@
date: 2016-03-09T19:56:50+01:00
title: Testing
post: "&nbsp;<i class='fas fa-fw fa-check-double'></i>"
weight: 500
weight: 800

While developing Sparta lambda functions it may be useful to test them locally without needing to `provision` each new code change. You can test your lambda functions

This file was deleted.

Oops, something went wrong.

0 comments on commit b6062da

Please sign in to comment.