IAM role with AWS SDK for php not working

I am trying to get detailed information on all EC2 instances running on AWS using the AWS SDK for PHP. To do this, I use an IAM role that I have already bound to another instance running the AWS SDK.

Here is my code:

require_once 'sdk.class.php';


$ec2 = new AmazonEC2(array(
  'default_cache_config' => '/tmp/secure-dir'
));

$result = $ec2->describe_instances();



$response = json_encode($result);

      

I created / tmp / secure -dir with full permissions. But when I execute the above script it returns "Auth Failure"

.

However, I can get information about all servers using AWS CLI.

Is there something I am missing?

Can anyone help me?

+3
php amazon-ec2


source to share


No one has answered this question yet

Check out similar questions:

4270
Link. What does this symbol mean in PHP?
2776
How can I prevent SQL injection in PHP?
2414
Why shouldn't I use the mysql_ * functions in PHP?
2335
Removing an element from an array in PHP
2024
How do you parse and process HTML / XML in PHP?
1906
How does PHP foreach work?
3
Issue using IAM role with PHP SDK
0
How to disable IAM role on a running AWS instance and add a new IAM role to that specific instance using Java
0
Strong AWS Deployment: Can We Use IAM Role Instead of Keys?
0
PHP SDK Unable to get AWS credentials for EC2 instance with IAM role enabled



All Articles
Loading...
X
Show
Funny
Dev
Pics