Best way of calling an AWS Lambda function from PHP using Amazon API Gateway

Viewed 1390

I have created an AWS Lambda function, using Claudia, express and node.js In this lambda function I have a few different endpoints, like:

/api/v1/something
/api/v1/somethingelse

I have created an API Gateway, using 'Lambda Function' as integration and I checked 'Use Lambda Proxy integration' - this is like a redirect as far as I've read from my gateway directly to the lambda function

My question is, how can I do a PHP call using the AWS Sdk to this?

My code is:

$client = LambdaClient::factory(array(
    'version' => "latest",
    'credentials' => array(
        'key' => '****',
        'secret' => '****'
    ),
    'region' => 'us-east-1'
));

$result = $client->invoke(array(
    'FunctionName' => 'My function name',
    'InvocationType' => 'RequestResponse',
));

If I use this, there is no way to specify the path, and I don't get any response ..

The only way is to do a curl request ... or what's the proper way ?

Thank you in advance!

0 Answers
Related