AWS Lambda function written in kotlin.
The steps explaining the code can be found here.
Run this in the project root, it generates a fat jar that can be found under lib/build/libs/lib-all.jar
./gradlew shadowJar
These commands should be run inside the lib
folder/module. THey will create an S3 bucket to store the final template
and use that final template to deploy the function.
aws s3 mb s3://lambda-kotlin
aws cloudformation package –template-file template.yml –s3-bucket lambda-kotlin –output-template-file template-out.yml
aws cloudformation deploy –template-file template-out.yml –stack-name lambda-kotlin –capabilities CAPABILITY_NAMED_IAM
aws lambda invoke --function-name <your_function_name> --payload '{ "content": "Hey!" }' out.json
out.json
file will contain the content of the response, something like: {"content":"Echo: Hey!"}