IntelliJ IDEA 2018.3.5 (Community Edition)
Build #IC-183.5912.21, built on February 26, 2019
JRE: 1.8.0_152-release-1343-b28 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
Needs SAM CLI 0.13.0
brew install aws-sam-cli
or
brew upgrade aws-sam-cli
Check the version:
sam --version
SAM CLI, version 0.14.1
Preferences
plugins
aws tooklkit
, select. Verify the version number is v1.2
at least and click on Install
.Restart IDE
to restart the IDECreate New Project
, AWS
, AWS Serverless Application
, Next
Maven
on top-right, add on +
, select pom.xml
HelloWorldFunction
, src
, main
, java
, helloworld
App.java
, standard Java imports and AWS SDKpublic class
, Create new AWS Lambda...
us-west-1
Create Function
AWS Explorer
in bottom left corner, expand Lambda
, refresh if need to
Show the Lambda function.This uses SAM Local CLI.
Run [Local] App
{}
Run
to run the function locally
This uses SAM Local CLI.
Debug [Local] App
This uses AWS SDK.
AWS Explorer
, click on Lambda
, select Hello Lambda
function, select Run [Remote] HelloLambda...
{}
Run
This uses CloudFormation.
Project Explorer
, open template.yaml
. This is SAM template. Explain Function
and Events
.Table
can be added.Deploy Serverless Application
Deploy
. It takes a few minutes for the CloudFormation stack to complete and then shows the output:
AWS Explorer
, expand Lambda
and CloudFormation
to see the newly created stack and the function
Run [Remote] hello-serve...
Run
, takes a few seconds and then shows the output: