block-user
block-user

Reputation: 115

How to use executable file within AWS lambda handler?

I want to use executable file within AWS lambda handler function. Here is my handler function where I want to use executable

func handler(){
    cmd := exec.Command("./balance", "GetBalance", id)
    cmd.Dir = "/Users/xxxx/go/src/getBalance"
    output, err := cmd.Output()
}

I want to use the output of the above command in this handler. Is it possible to use? If possible, do I need to zip both executables? Or is there any other way where I can use executable within the handler?

Upvotes: 1

Views: 1065

Answers (1)

Marcin
Marcin

Reputation: 238299

Sadly, you will not be able to write to /Users/xxxx/go/src/getBalance. In lambda, you have access only to /tmp.

Also, if you bundle the balance file with your deployment package it will be stored in /var/task alongside your function code.

EDIT:

Based on the new comments, to complete solution also required removal of cmd.Dir and recompilation of balance for linux.

Upvotes: 2

Related Questions