How to use Serverless Framework
-
serverless create --template aws-java-gradle --path my-service
- Available templates: aws-nodejs, aws-python, aws-java-maven, aws-java-gradle, aws-scala-sbt
-
- Use this to quickly upload and overwrite your AWS Lambda code on AWS, allowing you to develop faster.
serverless deploy function -f myfunction
-
- Invokes an AWS Lambda Function on AWS and returns logs.
serverless invoke -f hello -l
-
- Create AWS credentials
- Export AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID
export AWS_ACCESS_KEY=ABCDEFGHIJK****
export AWS_SECRET_ACCESS_KEY=+KAABCDEFGH/IJK*******
-
gradle clean buildZip
-
- Lambda function will be deployed
- DynamoDB will be created
serverless deploy
-
serverless invoke -f createRating --path data.json
-
serverless invoke -f getRating --path data.json