Skip to content

encalmo/scala-aws-lambda-seed.g8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-aws-lambda-seed.g8

A Giter8 template for creating simple scala lambda project using scala-aws-lambda-runtime

How to create a new project based on the template?

  • Go to directory where you want to create the template

  • Decide your project name (the hardest part :))

  • Run the command like

    sbt new encalmo/scala-aws-lambda-seed.g8 --branch main --lambdaName="ExampleLambda" --awsAccountId="047719648492" --awsRegion="eu-central-1" --package="org.encalmo.lambda.example" -o scala-aws-lambda-seed

or

  • Install g8 commandline tool (http://www.foundweekends.org/giter8/setup.html)

  • Run the command like

    g8 encalmo/scala-aws-lambda-seed.g8 --branch main --lambdaName="ExampleLambda" --awsAccountId="047719648492" --awsRegion="eu-central-1" --package="org.encalmo.lambda.example" -o scala-aws-lambda-seed

and then

cd scala-aws-lambda-seed
git init
git add .
git commit -m start
  • Test generated project using command

    ./test.sh

How to test the template and generate an example project?

  • Run ./test.sh

An example project will be then created and tested in target/sandbox/scala-aws-lambda-seed

How to modify the template?

  • review template sources in /src/main/g8
  • modify files as you need, but be careful about placeholders, paths and so on
  • run ./test.sh in template root to validate your changes

or (safer) ...

  • run ./test.sh first
  • open target/sandbox/scala-aws-lambda-seed in your preferred IDE,
  • modify the generated example project as you wish,
  • build and test it as usual, you can run ./test.sh,
  • when you are done switch back to the template root
  • run ./update-g8.sh in order to port your changes back to the template.
  • run ./test.sh again to validate your changes

What is in the template?

Assuming the command above the template will supply the following values for the placeholders:

$packaged$ -> org/encalmo/lambda/example
$package$ -> org.encalmo.lambda.example
$lambdaName$ -> ExampleLambda
$awsAccountId$ -> 047719648492
$awsRegion$ -> eu-central-1

and produce the folders and files as shown below:

├── .github
│   └── workflows
│       └── buildAndDeployLambda.yaml
│
├── .gitignore
├── .scalafmt.conf
├── build.sh
├── ExampleLambda.scala
├── ExampleLambda.test.scala
├── lambda-deployment-config.json
├── LICENSE
├── project.scala
├── README.md
├── reflect.json
├── run.sh
├── scripts
│   ├── buildAndDeployLambdaAssembly.sh
│   ├── buildAndDeployLambdaNativePackage.sh
│   ├── buildAndRunLambdaAssembly.sh
│   ├── buildAndRunLambdaNativePackage.sh
│   ├── buildLambdaAssembly.sh
│   ├── buildLambdaNativePackage.sh
│   ├── deployLambda.sc
│   ├── runLambdaAssembly.sh
│   ├── runLambdaLocallyUsingCommandLine.sh
│   ├── runLambdaLocallyUsingWebBrowser.sh
│   └── runLambdaNativePackage.sh
│
├── test.sh
└── TestSuite.test.scala

About

Simple Scala AWS Lambda project seed

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published