Skip to content

IAM Instance Profile Credentials and Amazon EC2 instances. #52

@jordanaubert

Description

@jordanaubert

Hi !

There is a feature described in the README :

Automatically uses [IAM Instance Profile Credentials][aws-iam-credentials] on configured Amazon EC2 instances.

But i can see in doc/todo.md file :

4.Using credentials from environment variables, credentials profiles or env provider[...]

so i suppose this feature isn't effective after all.

In the PHPDoc of the AwsClient constructor we can see :

(Aws\Credentials\CredentialsInterface|array|bool|callable) [...] If no credentials are provided, the SDK will attempt to load them from the environment.

So instead of use

$this->sdk = new Sdk(
             array(
                 'region'  => $this->getRegion(),
                 // use specific aws sdk php version or latest version if not defined
                 'version' => ($this->getVersion() != ' ' ) ? $this->getVersion() : 'latest',
                 'credentials' => CredentialProvider::env()
             )
         );

suggested in doc/todo.md, we should use :

$options = array(
            'region'  => $this->getRegion(),
            // use specific aws sdk php version or latest version if not defined
            'version' => ($this->getVersion() !== '') ? $this->getVersion() : 'latest',
        );

        if ($this->getKey() !== '' && $this->getSecret() !== '') {
            $options['credentials'] = new Credentials($this->getKey(), $this->getSecret());
        }

        $this->sdk = new Sdk($options);

Hope this could help.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions