AWS SAM for Java applications is not compatible with VSCode, the languages that VSCode + SAM supports are: Nodejs, .NET and Python (2.x and 3.x). To see the development of the discovery see post.
To use SAM in IntelliJ is necessary:
- AWS account: Choose Create an AWS Account, or Complete Sign Up.
- AWS CLI: The AWS Command Line Interface (AWS CLI) is an open source tool that enables you to interact with AWS services using commands in your command-line shell.
- Docker: The AWS SAM CLI requires this open-source software container platform.
- AWS SAM CLI: This is an AWS CLI tool that helps you develop, test, and analyze your serverless applications locally.
- Maven.
- JDK.
- IntelliJ IDEA.
To see my experience and problems encountered see post.
-
Configure AWS CLI:
-
Install AWS Toolkit in IntelliJ: File > Settings:
-
In IntelliJ, chose File > New > Project...
and apply this config:
It will show an AWS demo project with which we will continue explaining how to use SAM.
-
Connect IntelliJ IDEA with AWS: Press tab "AWS Explorer"
and then the configuration profile that we want to use. If in step 1.2. you have made "aws configure" without specifying any profile, this profile will be default.
It is possible to run and debug the application on IntelliJ, for this you have to apply a configuration like this:
To deploy the application:
and apply the configuration
- Stack: The name of the AWS CloudFormation stack that is create when deploying this serverless application.
- S3 Bucket: AWS repository where the application will be stored (create one if none exists).
After configuration press deploy and the result will look like this:
We can ensure that the application was deployed by consulting the AWS Web environment in the Lambda section: