Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Pynamodb | 2,177 | 1 | 5 days ago | 13 | June 09, 2022 | 258 | mit | Python | ||
A pythonic interface to Amazon's DynamoDB | ||||||||||
Saw | 1,320 | 2 months ago | 13 | February 11, 2021 | 45 | mit | Go | |||
Fast, multi-purpose tool for AWS CloudWatch Logs | ||||||||||
Aws | 835 | 3 months ago | 2 | apache-2.0 | Shell | |||||
A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq. | ||||||||||
Goformation | 807 | 44 | 6 days ago | 62 | June 10, 2021 | 50 | apache-2.0 | Go | ||
GoFormation is a Go library for working with CloudFormation templates. | ||||||||||
Iam Policy Json To Terraform | 680 | 10 days ago | 7 | February 06, 2021 | 10 | apache-2.0 | Go | |||
Small tool to convert an IAM Policy in JSON format into a Terraform aws_iam_policy_document | ||||||||||
Aws Security Viz | 665 | a day ago | 176 | August 15, 2021 | 4 | mit | Ruby | |||
Visualize your aws security groups. | ||||||||||
Devops Python Tools | 658 | 3 days ago | 32 | mit | Python | |||||
80+ DevOps & Data CLI Tools - AWS, GCP, GCF Python Cloud Functions, Log Anonymizer, Spark, Hadoop, HBase, Hive, Impala, Linux, Docker, Spark Data Converters & Validators (Avro/Parquet/JSON/CSV/INI/XML/YAML), Travis CI, AWS CloudFormation, Elasticsearch, Solr etc. | ||||||||||
Awacs | 389 | 120 | 23 | 3 days ago | 39 | January 01, 2022 | 14 | bsd-2-clause | Python | |
Python library for AWS Access Policy Language creation | ||||||||||
Nodb | 330 | 1 | 3 years ago | 7 | September 26, 2017 | 14 | Python | |||
NoDB isn't a database.. but it sort of looks like one. | ||||||||||
Foremast | 277 | 2 | a year ago | 392 | December 01, 2021 | apache-2.0 | Python | |||
Spinnaker Pipeline/Infrastructure Configuration and Templating Tool - Pipelines as Code. |
Writing a handler for AWS lambda in Scala can be as easy as...
import io.circe.generic.auto._
import io.github.mkotsur.aws.handler.Lambda._
import io.github.mkotsur.aws.handler.Lambda
import com.amazonaws.services.lambda.runtime.Context
case class Ping(inputMsg: String)
case class Pong(outputMsg: String)
class PingPongHandler extends Lambda[Ping, Pong] {
override def handle(ping: Ping, context: Context) = Right(Pong(ping.inputMsg.reverse))
}
The input JSON will be automatically de-serialized into Ping
, and the output into Pong
. The handle()
method is supposed to return Either[Throwable, Pong]
: Right
if the input was handled correctly, and Left
otherwise.
This handler can be used in AWS Lambda as: io.github.mkotsur.example::handle
.
Features:
import io.circe.generic.auto._
import io.github.mkotsur.aws.handler.Lambda._
import io.github.mkotsur.aws.handler.Lambda
import com.amazonaws.services.lambda.runtime.Context
import scala.concurrent.Future
case class Ping(inputMsg: String)
class PingFuturePongHandler extends Lambda[Ping, Future[Int]] {
override def handle(ping: Ping, context: Context) =
Right(Future.successful(ping.inputMsg.length))
}
This lambda will accept an empty string, or string with null
as an input.
import io.circe.generic.auto._
import io.github.mkotsur.aws.handler.Lambda._
import io.github.mkotsur.aws.handler.Lambda
import com.amazonaws.services.lambda.runtime.Context
class NothingToNothingHandler extends Lambda[None.type, None.type] {
override protected def handle(i: None.type, c: Context) = {
println("Only side effects")
Right(None)
}
}
You can write less boilerplate when implementing a handler for API Gateway proxy events by extending Lambda.ApiProxy[I, C, O]
. There are three type parameters there. The first one (I
) corresponds to the body
field of the API Gateway proxy event
, the second one (C
) corresponds to requestContext
field, and the third one – to the body
in the response object. More info about how the even looks like here.
import io.circe.generic.auto._
import io.circe.Json
import io.github.mkotsur.aws.handler.Lambda._
import io.github.mkotsur.aws.proxy._
import io.github.mkotsur.aws.handler.Lambda
import com.amazonaws.services.lambda.runtime.Context
import MyProxy._
object MyProxy {
case class MyRequestBody(name: String)
case class MyResponseBody(score: Int)
}
class MyProxy extends Lambda.ApiProxy[MyRequestBody, Json, MyResponseBody] {
override def handle(
i: ApiProxyRequest[MyRequestBody, Json],
c: Context
): Either[Throwable, ApiProxyResponse[MyResponseBody]] =
i.body match {
case Some(MyRequestBody("Bob")) =>
Right(ApiProxyResponse.success(Some(MyResponseBody(100))))
case Some(MyRequestBody("Alice")) =>
Right(ApiProxyResponse.success(Some(MyResponseBody(50))))
case Some(_) =>
Right(ApiProxyResponse(404))
case None =>
Left(new IllegalArgumentException)
}
}
Tip 1: of course, you can also pass a type defined by a case class into the second type parameter. Please check #24 and src/test/scala/io/github/mkotsur/aws/proxy/ProxyRequestTest.scala
for an example.
Tip 2: Don't forget that Lambda.ApiProxy
is a very thin wrapper around Lambda
, so if something in ApiProxyRequest
or ApiProxyResponse
doesn't work for you - feel free to define your own case classes (and if you believe that the use case is generic enough – consider contributing back to the library).
Feel free to look at src/test/scala
for more examples. And of course, contributions to the docs are welcome!
Scala versions supported: 2.11.x, 2.12.x, 2.13.x.
libraryDependencies += "io.github.mkotsur" %% "aws-lambda-scala" % {latest-version}
Short answer: they complement each other. Long answer: read this blog post.