Calling AWS Lambda from Kotlin?

Hi all! This is my first time here, so please forgive me if this topic has been covered anywhere - I ran some searches and couldn’t find anything.

We are developing some Android applications that consume business logic implemented in AWS Lambda. We have been working in Java, but it’s a tedious job - and I’m a very experienced Java programmer! Most of the development is being done by a colleague who is far less experienced in Java and it is a steep learning curve. We have looked at Kotlin and it looks promising, but I can’t find any information on how to call AWS Lambda functions. Anyone got any experience of making it work?

TIA
Martin

I had to figure this out about a year ago or so, and I remember the documentation being a little sparse. Here’s what I remember from the code I have.

You can use the AWS java sdk for lambda:

    val lambdaClient = AWSLambdaAsyncClient()

    val payload = gson.toJson(params)

    val request = InvokeRequest()
            .withFunctionName("lambda-function-name")
            .withPayload(payload)
            .withInvocationType(InvocationType.Event) // Event should be async
    // I dont remember what other kinds of Invocation types there are, but I believe the default blocks.

    val result = lambdaClient.invoke(request)