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

No credentials in response from EC2_SERVER_URI #1

Open
styxiak opened this issue May 4, 2020 · 1 comment
Open

No credentials in response from EC2_SERVER_URI #1

styxiak opened this issue May 4, 2020 · 1 comment

Comments

@styxiak
Copy link

styxiak commented May 4, 2020

First request to http://169.254.169.254/latest/meta-data/iam/security-credentials/ return role name, but credentials is expected.
Second request returns credentials. In my case working function is:

private function getInstanceProfileCredentials()
    {
        $url = self::EC2_SERVER_URI.self::CRED_PATH;
        $curl_result = $this->curl($url);
        $response = trim($curl_result['content']);
        $url = self::EC2_SERVER_URI.self::CRED_PATH.$response;
        $curl_result = $this->curl($url);
        $response = $curl_result['content'];
        $result = $this->decodeResult($response);
        return [
            'key' => $result['AccessKeyId'],
            'secret' => $result['SecretAccessKey'],
            'token' => $result['Token'],
            'expiration' => strtotime($result['Expiration']),
        ];
    }

@ajoseph-godaddy
Copy link

I can confirm the above worked for me as well as I just ran into this issue.

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