https://kotlinlang.org logo
Title
s

Siva Ganesh

10/12/2020, 4:18 PM
Does anyone worked on ktor with AWS lambda, if so can you share a GitHub repo.
n

Nico

10/12/2020, 4:22 PM
what is your use case specifically? Using a ktor client inside a lamda?
s

Siva Ganesh

10/12/2020, 4:25 PM
Actually I was trying to write Rest APIs for my website. It was first time with backend development.
I was kind of in the middle wether to use Google cloud or AWS to host ktor project
c

Casey Brooks

10/12/2020, 5:13 PM
Kotless is a JB tool for serverless Kotlin development. It does the hard work of AWS Lambda deployment and you can just write your ktor app mostly as normal https://github.com/JetBrains/kotless
❤️ 5
n

Nico

10/12/2020, 5:34 PM
Can recommend kotless if you want to write ktor-like stuff to host your API in AWS
👍 2
The alternative is to use Lambdas + AWS API Gateway manually (no ktor) which is what kotless does under the hood anyway
1
r

Razvan

10/13/2020, 12:36 PM
You can also try http4k (havn't try but in their documentation they talk about) https://www.http4k.org/guide/modules/serverless/
d

Dávid

10/15/2020, 9:50 AM
Or if you would like to stick to Ktor, then deploy it to EC2 or Fargate 🙂 In some cases that could even be cheaper, depending on your traffic and response times.
s

Siva Ganesh

10/15/2020, 11:03 AM
Those are new names, I'll give a try for sure, thanks. Do you have some suggests for database integration
d

Dávid

10/15/2020, 12:00 PM
@Siva Ganesh one use case for Lambda is "serverless" applications, which as the name says does not need a server like ktor (and other people named nice solutions to achieve your goals with other frameworks). In these setups, your lambdas are not running, and they are triggered by something (in this case Api Gateway which handles routing etc.), for these triggers they "wake up or spawn" and handle your request and they "die/go back to sleep . They are designed to have a short lifespan (as short as possible from the perspective of bills 😄 ) Ktor server is something that usually you want to have running all the time listening for requests and handle them, you dont need Api Gateway because the routes are defined in ktor. You need some computer or virtual machine to be running all the time to host this application, cloud providers have solutions for this use case. In AWS Lightsail, Elastic Beanstalk, EC2, ECS (with EC2 or Fargate) are solutions for this. https://aws.amazon.com/websites/?nc2=h_ql_sol_use_web
❤️ 1
For DB access you can use https://github.com/JetBrains/Exposed it does not have migrations unfortunately
r

Razvan

10/18/2020, 8:58 AM
For Serverless database you can also use [FaunaDB](https://docs.fauna.com/fauna/current/drivers/jvm) they have a java Driver that is quite functional.