Skip to content

Instantly share code, notes, and snippets.

@dsalcedo
Forked from robinvdvleuten/lambda-helloWorld.php
Created March 4, 2019 16:40
Show Gist options
  • Save dsalcedo/d49bb03e0cbe21e5fc54307b363419ba to your computer and use it in GitHub Desktop.
Save dsalcedo/d49bb03e0cbe21e5fc54307b363419ba to your computer and use it in GitHub Desktop.
Invoke sample Lambda function through PHP
<?php
require_once __DIR__.'/vendor/autoload.php';
use Aws\Lambda\LambdaClient;
$client = LambdaClient::factory([
'version' => 'latest',
// The region where you have created your Lambda
'region' => 'eu-west-1',
]);
$result = $client->invoke([
// The name your created Lamda function
'FunctionName' => 'hello-world',
]);
echo json_decode((string) $result->get('Payload'));
// You'll now see "Hello, World! in your output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment