Skip to content

Latest commit

 

History

History

powertools-examples-core-utilities

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Powertools for AWS Lambda (Java) - Core Utilities Example

This project demonstrates the Lambda for Powertools Java module - including logging, tracing, and metrics.

The example application is the same, and you can now also use Kotlin!

Java

We also provide an example showing the integration of SAM, Powertools, and Gradle:

  • App.java - Code for the application's Lambda function.
  • AppTests.java - Unit tests for the application code.
  • events - Invocation events that you can use to invoke the function.

Configuration files and deployment process for each tool are described in corresponding README files.

Kotlin

Example application consists of the following files:

  • App.kt - Code for the application's Lambda function.
  • AppTests.kt - Unit tests for the application code.
  • events - Invocation events that you can use to invoke the function.

Configuration files and deployment process for each tool are described in corresponding README files.

Test the application

Once the app is deployed, you can invoke the endpoint like this:

 curl https://[REST-API-ID].execute-api.[REGION].amazonaws.com/Prod/hello/

The response itself isn't particularly interesting - you will get back some information about your IP address. If you go to the Lambda Console and locate the lambda you have deployed, then click the "Monitoring" tab you will be able to find:

  • View X-Ray traces - Display the traces captured by the traces module. These include subsegments for the different function calls within the example
  • View Cloudwatch logs - Display the structured logging output of the example

Likewise, from the CloudWatch dashboard, under Metrics, all metrics, you will find the namespaces Another and ServerlessAirline. The values in each of these are published by the code in the respective application's Lambda function.