NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class RefreshableInstanceProfileCredentials

Credentials decorator used to implement retrieving credentials from the EC2 metadata server

  Aws\Common\Credentials\AbstractCredentialsDecorator implements Aws\Common\Credentials\CredentialsInterface
  Aws\Common\Credentials\AbstractRefreshableCredentials
  Aws\Common\Credentials\RefreshableInstanceProfileCredentials

Namespace: Aws\Common\Credentials
Located at Aws/Common/Credentials/RefreshableInstanceProfileCredentials.php

## Methods summary

- `public` `__construct ( Aws\Common\Credentials\CredentialsInterface $credentials, Aws\Common\InstanceMetadata\InstanceMetadataClient $client = null )`

  Constructs a new instance profile credentials decorator

- `public` `setClient ( Aws\Common\InstanceMetadata\InstanceMetadataClient $client = null )`
- `public` `serialize ( )`
- `public` `unserialize ( mixed $value )`
- `protected` `refresh ( )`

  Attempt to get new credentials from the instance profile

## Methods detail

# `public`
`__construct( `Aws\Common\Credentials\CredentialsInterface` $credentials, `Aws\Common\InstanceMetadata\InstanceMetadataClient` $client = null )`

Constructs a new instance profile credentials decorator

#### Parameters

$credentials
  ``Aws\Common\Credentials\CredentialsInterface``
  $credentials Credentials to adapt
$client
  ``Aws\Common\InstanceMetadata\InstanceMetadataClient``
  $client Client used to get new credentials

#### Overrides

`Aws\Common\Credentials\AbstractCredentialsDecorator::__construct`
# `public`
`setClient( `Aws\Common\InstanceMetadata\InstanceMetadataClient` $client = null )`
# `public`
`serialize( )`

#### Overrides

`Aws\Common\Credentials\AbstractRefreshableCredentials::serialize`
# `public`
`unserialize( mixed $value )`

#### Overrides

`Aws\Common\Credentials\AbstractCredentialsDecorator::unserialize`
# `protected`
`refresh( )`

Attempt to get new credentials from the instance profile

#### Throws

``Aws\Common\Exception\InstanceProfileCredentialsException``
On error

### Methods inherited from Aws\Common\Credentials\AbstractRefreshableCredentials

`getAccessKeyId()`, `getCredentials()`, `getSecretKey()`, `getSecurityToken()`

### Methods inherited from Aws\Common\Credentials\AbstractCredentialsDecorator

`getExpiration()`, `isExpired()`, `setAccessKeyId()`, `setExpiration()`, `setSecretKey()`, `setSecurityToken()`

### Magic methods summary

## Properties summary

`protected `Aws\Common\InstanceMetadata\InstanceMetadataClient`` | $client | #

### Properties inherited from Aws\Common\Credentials\AbstractCredentialsDecorator

`$credentials`