If you have to use one of their services with the new PHP SDK 3.31 you will have to first install it using composer
composer install aws/aws-sdk-php
then you have to
- Create AWS account here https://aws.amazon.com
- Go to How to get Access keys for Access keys instructions
- Add user with Full access to your desired service
And the sample PHP code is:
use Aws\Sdk;
$sdk = new Sdk([
'region' => 'eu-west-1', // your account region
'version' => 'latest',
]);
// This is example using AWS SQS
$sqs = $sdk->createSqs([
'region' =>'eu-west-1', // your account region
'version' => 'latest',
'credentials' => [
'key' => 'access_key',
'secret' => 'secret_access_key',
],
]);
You can also put the access key and secret access key in the environment vars and the SDK will get them from there or you can check this URL for how to use credentials
putenv('AWS_ACCESS_KEY_ID=' . $accessKey);
putenv('AWS_SECRET_ACCESS_KEY=' . $secretAccessKey);
putenv('AWS_SESSION_TOKEN=' . $sessionToken);
In the PHP SDK they are using Promises and because of that you will need these Class reference docs to check all properties and methods of all services