How to create, debug and deploy AWS Serverless Application with Java using IntelliJ IDEA

Hiep Dinh
INNOMIZE
Published in
3 min readNov 13, 2019

IntelliJ IDEA is the most popular IDE for Java. So it’s useful if we can develop, debug, and deploy AWS Serverless Application with IntelliJ IDEA.
This article will guide step by step from creating, debugging to deploying AWS Serverless Application.

Requirements

Before you can use IntelliJ IDEA to develop, test, analyze, debug, and deploy AWS Serverless Application, you must first also install the following tools:

Creating an AWS Serverless Application

This is step by step to create new AWS Serverless Application

You can select which build tool for the project: Maven or Gradle

Project structure after creating successfully

Debugging the Local Version of an AWS Lambda Function

You can debug by doing one of the following:
1. In the code file that contains the function handler choose the Lambda icon in the gutter next to the function handler. Choose Debug ‘[Local]’:

2. Open the project’s template.yaml file. Choose the Run icon in the gutter next to the function’s resource definition, and then choose Debug ‘[Local]’.

Finally, complete the Edit configuration dialog box if it is displayed, and then choose Debug. Using API Gateway proxy event to test function.

SAM will fetch lambci/lambda:java8 Docker container image to run function locally.

You can add backbone to begin debug the application.

Deploying an AWS Serverless Application

Select a AWS profile which you will use to deploy. Note: you can config AWS profile by using AWS CLI

Right-click the project’s template.yaml file. Then select Deploy Serverless Application action

Complete the Deploy Serverless Application dialog box, and then choose Deploy.

After you deploy it, you can go to the AWS console to run / test AWS Lambda function.

Conclusion

By using IntelliJ IDEA to create, debug and deploy AWS serverless applications, building AWS serverless application will become easier and the time for troubleshooting issues will be reduced by debugging locally.

--

--

Hiep Dinh
INNOMIZE

"Anything that can go wrong will go wrong" — Murphy's law