Coder Social home page Coder Social logo

aws-lambda-hello-log's Introduction

AWS Lambda Java Hello Logs

This library can be used for 'Hello World' Lambda testing and demonstrates the different possibilities of passing parameters to your Java Lambda function. These classes are a good tool for getting started with implementing custom Lambda functions.

The .jar must be built and uploaded to AWS using the AWS Console.

Getting started and deploying the classes.

AWS Console -> Services -> Compute -> Lambda -> Create a Lambda function -> Blank Function (template) -> Next -> Name: aws-hello-log -> Runtime: Java 8 -> Function package: Upload your .jar -> Environment variables: set some so that you can see them in the output -> Handler: Pick one of the handlers e.g. com.udoheld.aws.lambda.HelloLogSimple -> Role: Create new role from template(s) -> Role name: Pick something e.g. aws-lambda-hello-role -> Memory (MB): 128 -> Timeout: 3s -> Next -> Create function -> Test -> Template: Leave the Hello World template or modify it as you with -> Save And Test

Loggers

The parameters can be passed in different ways to the logger. All working loggers print their own name, the version and the input. One logger which is not implemented and documented online lists retrieving an integer as an example.

For getting started running HelloLogSimple is recommended.

None of the loggers makes use of the output. I didn't see anything AWS would do with it. Maybe it could be used for local testing.

HelloLogSimple

This logger prints the input and most of the useful variables. The would be a starting point for a flexible implementation.

HelloLogFull

This logger prints the input and all available variables.

HelloLogPojo

This logger directly processes your input as a POJO. Therefor the parameter names of your JSON have to match the bean properties of your implementation. This implementation relies on the "Hello World" test template passing

{"key3":"value3","key2"="value2","key1":"value1"}
.

This would be a starting point for a fully typed implementation.

HelloLogStream

This logger provides the input as a stream. This could probably parse non-Json input.

HelloLogStringHandlerNotWorking

While this logger implements the handler and expects a String you will get an JsonMappingException.

HelloLogStringDocNotWorking

While this handler is implemented as per documentation it won't work. The AWS runtime expects that a handler is implemented and will throw an exception.

Known problems

At the time of writing the clientContext isn't populated. According to the java-doc these should hold some client information as well as the self defined environment variables. At the moment these variables can however be retrieved getting the system variables as shown in the code.

In the official documentation a String implementation is documented. I didn't get it to work.

License

AWS Lambda Java Hello Logs are released under version 3.0 of the LGPL License.

aws-lambda-hello-log's People

Contributors

udoheld avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.