AWS Developer Tools Blog

Creating Lambda Stream Functions Using the AWS Toolkit for Eclipse

In this blog post, I will introduce two new features in the AWS Toolkit for Eclipse: creating an AWS Lambda stream function and creating multiple AWS Lambda functions in a single project. Unlike the normal AWS Lambda functions which take in POJOs for handler Input/Output, the AWS Lambda stream functions let you use the InputStream and OutputStream as the input and output types for the handler. For more information about the AWS Lambda stream handler, see this example in the AWS Lambda Developer Guide. For information about how to use the AWS Toolkit for Eclipse to develop, deploy, and test Lambda functions, see this blog post.

  1. Create a Lambda stream handler.You can use either the Create New AWS Lambda Java Project wizard or the Create New AWS Lambda Function wizard. From Handler Type, choose Stream Request Handler. The stream request handler template will appear in the Preview field. (The syntax highlighting in the template is another recently added feature.)

    After you choose Finish, the AWS Toolkit for Eclipse will create a Lambda stream handler class and the unit test for that Lambda stream function. The stream handler template is a simple implementation of capitalizing the characters of the input stream and writing to the output stream. The following screenshot is the initial project structure:


  2. Create a Lambda function in a project.You can now create multiple Lambda functions in a single Lambda project. There are a number of ways to create a Lambda function class in your existing Lambda project:
  • On the Eclipse menu, from File, choose New, and then choose AWS Lambda Function.
  • On the Eclipse toolbar, choose New and then choose AWS Lambda Function.
  • On the Eclipse toolbar, from the AWS Toolkit for Eclipse drop-down menu (identified by the AWS icon), choose New AWS Lambda Function.
  • In Eclipse, press Ctrl + N, and from the AWS folder, choose AWS Lambda Function.
  • In the Package Explorer view of Eclipse, right-click and choose New, and then choose AWS Lambda Function.The following screenshot shows the Create a new AWS Lambda function wizard.

    After you choose Finish, the newly created Lambda handler Java file, unit test Java file, and other resource files will be appended to the existing project.

How do you like these new features? Please feel free to leave your feedback in the comments. And, as always, let us know what other features you would like us to provide.