Skip to main content
knackforge blog knowledge base


Amazon Web services have N number of services, one among them is Aws Identity and Access Management(IAM). IAM allows you to securely access the AWS services.

Using IAM you can control the who can use your AWS service and what resource they can use. With IAM, you can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources.

We can integrate IAM with many platforms like NodeJS, .NET, Java etc., Here we can see how to use AWS IAM with PHP platform.
require '/path/to/aws-autoloader.php';

$body  = array(‘type’ => ‘search’, ‘keyword’ => ‘phones’);
$credentials = new Aws\Credentials\Credentials(‘access_key’, ‘secret_key’);
// Prepare a CloudSearchDomain request
$headers = array('x-api-key' => 'api_key, 'Content-Type => application/x-www-form-urlencoded');
$request = new GuzzleHttp\Psr7\Request('POST', ', ['Content-Type' => 'application/x-www-form-urlencoded'],  http_build_query($body, null, '&'));
// Construct a request signer
$signer = new Aws\Signature\SignatureV4('execute-api', 'us-west-2');
// Sign the request
$request = $signer->signRequest($request, $credentials);
// Send the request
$headers = array('Content-Type => application/x-www-form-urlencoded');
$client = new \GuzzleHttp\Client([ 'headers' => $headers]);
$response = $client->send($request);
$result = $response->getBody();

Installing Via ZIP

AWS SDK for PHP framework can be downloaded at

Installing via Composer

  1. Install Composer

    1. curl -sS | php

  2. Run the Composer command to install the latest stable version of the SDK:

    1. php composer.phar require aws/aws-sdk-php

  3. Require Composer's autoloader:

    1. <?php
      require 'vendor/autoload.php';


AWS IAM has lots of features some of them are

  • Shared access to your AWS account

  • Granular permissions

  • Secure access to AWS resources for applications that run on Amazon EC2

  • Multi-factor authentication (MFA)

  • Identity federation

  • Identity information for assurance

  • Integrated with many AWS services

  • Free to use