In this post we will use AWS Serverless Application Model (SAM) to create and deploy a simple Lambda function written in Java.
sam init -r java8 -n hello_world_lambda
Change to the newly created directory hello_world_lambda
.
sam build
sam local invoke --event events/event.json
sam package --output-template-file packaged.yaml --s3-bucket existing_bucket_name
sam deploy --template-file packaged.yaml --stack-name hello-world-lambda --capabilities CAPABILITY_IAM
Get the API Gateway endpoint url
aws cloudformation describe-stacks --stack-name hello-world-lambda
Invoke API
curl endpoint url
aws cloudformation delete-stack --stack-name hello-world-lambda