Giter Club home page Giter Club logo

aws-lambda-api-gw's Introduction

aws-lambda-api-gw

Java AWS Lambda to show calling another service / api

This code is an AWS Lambda that is meant as a demonstration for calling another API from within the Lambda. The API that is called is from icanhazdadjoke.com which provides a super simple API to interact with. This code assumes that it will be fronted with API Gateway and returns values based on that assumption.

Building

The code is built using maven and leverages Java APIs in Java 11 and above. To build simply run:

mvn clean package

The build uses Java 21 which is the most recent Java supported by the AWS Java Lambda runtime. It should be deployed via the AWS console. Yes, this is "click ops" but this code isn't meant to be one of your production Lambda's (unless your business is to generate a stream of dad jokes).

Runtime notes

As indicated, this code is meant to have API Gateway in front of it. It will, however, run fine from the console or AWS CLI for testing. But the returned object is a APIGatewayProxyResponseEvent so, if called without API Gateway, you'll get a different object than expected.

Note that the very first run of this code takes about 4 seconds with a 512MB Lambda. After that the response times are around 200-300 ms. The called API is the vast majority of that time.

aws-lambda-api-gw's People

Contributors

stdunbar avatar sdunbar-wrs avatar

Watchers

 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.