Skip to content

ianfoo/aws-lambda-go-demo

Repository files navigation

aws-lambda-go-demo

This is a demonstration of native AWS Lambda Golang support.

Given a JSON request with a location and optional format field, it will return the time in the specified time zone.

location is a time zone name from the IANA Time Zone Database.

format is a Golang time format. If no time format is specified, the service will default to the time.UnixDate time format.

Credits

This was completed by following the first portion of the AWS Lambda Golang introductory blog post, with a handler that performed a slightly different funciton than string concatenation (just because).

Notes

While the AWS Lambda Go SDK is advanced enough to automatically marshal and unmarshal to and from custom request and response types (within certain limits), I opted to use the raw events.APIGatewayProxyRequest and events.APIGatewayProxyResponse to allow for greater granularity in the handler. For example, logging the request ID (as is done in the initial example in the blog post referenced above) and controlling the status code when errors occur.

TODO

  • Format errors as JSON.
  • Get this set up with continuous deployment as described in the rest of the referenced AWS blog post.

About

Native AWS Golang support demo project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published