Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAM Instance Profile Credentials and Amazon EC2 instances. #52

Open
jordanaubert opened this issue Feb 26, 2016 · 4 comments
Open

IAM Instance Profile Credentials and Amazon EC2 instances. #52

jordanaubert opened this issue Feb 26, 2016 · 4 comments
Assignees

Comments

@jordanaubert
Copy link
Contributor

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.

@jordanaubert jordanaubert mentioned this issue Feb 26, 2016
1 task
@PawnKaiser
Copy link
Member

Hi,

you are right, this feature hasn't been implemented yet, and is was planned for the next release, i'll commit some fix regarding unit tests and services including all credentials providers methods namely env credentials provider. many thanks for your updates

@jordanaubert
Copy link
Contributor Author

Okay, thank you ! 👍

@jordanaubert
Copy link
Contributor Author

We could improve this update changing

->scalarNode('key')->isRequired()->end()
->scalarNode('secret')->isRequired()->end()

by

->scalarNode('key')->defaultValue('')->end()
->scalarNode('secret')->defaultValue('')->end()

in DependencyInjection/Configuration.php

@PawnKaiser
Copy link
Member

yes i'll do

@PawnKaiser PawnKaiser self-assigned this Mar 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants