1

Having some trouble with this code:

$ec2 = Ec2Client::factory(array(
        'AWS_KEY' => AWS_KEY,
        'AWS_SECRET_KEY' => AWS_SECRET_KEY,
        'region' => 'us-east-1',
    )); 

echo "<pre>";
var_dump($ec2->describeInstances());

I'm constantly receiving this:

Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 28: Connection time-out [url] http://169.254.169.254/latest/meta-data/iam/security-credentials/' in /**/**/**/htdocs/**/vendor/Guzzle/Http/Curl/CurlMulti.php:578

I also receive this if I use $aws = AWS::factory() followed by $ec2 = $aws->get('ec2')

1 Answer 1

1

The exception is because you haven't specified the key and secret key properly so the code is (automatically) trying to get the IAM credentials from that URL.

You should use 'key' and 'secret' in your array.

$ec2 = Ec2Client::factory(array(
        'key' => AWS_KEY,
        'secret' => AWS_SECRET_KEY,
        'region' => 'us-east-1',
    )); 
Sign up to request clarification or add additional context in comments.

1 Comment

Bah, such a simple thing. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.