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.
Before you can use IntelliJ IDEA to develop, test, analyze, debug, and deploy AWS Serverless Application, you must first also install the following tools:
- AWS Command Line Interface (AWS CLI)
- AWS Serverless Application Model Command Line Interface (AWS SAM CLI)
- IntelliJ IDEA (2019.2)
- Plugin AWS Toolkit for IntelliJ IDEA
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 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 choose Deploy Serverless Application.
Complete the Deploy Serverless Application dialog box, and then choose Deploy.
After you deploy it, you can go to aws console to run / test AWS Lambda function.
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.