Class InstanceProfileProvider
Credential provider that provides credentials from the EC2 metadata service.
Methods Summary
-
__construct ( array $config = [] )
The constructor accepts the following options:
-
__invoke ( $previousCredentials = null )
Loads instance profile credentials.
Methods Details
__construct ( array $config = [] )
The constructor accepts the following options:
- timeout: Connection timeout, in seconds.
- profile: Optional EC2 profile name, if known.
- retries: Optional number of retries to be attempted.
- ec2_metadata_v1_disabled: Optional for disabling the fallback to IMDSv1.
- endpoint: Optional for overriding the default endpoint to be used for fetching credentials. The value must contain a valid URI scheme. If the URI scheme is not https, it must resolve to a loopback address.
- endpoint_mode: Optional for overriding the default endpoint mode (IPv4|IPv6) to be used for resolving the default endpoint.
- use_aws_shared_config_files: Decides whether the shared config file should be considered when using the ConfigurationResolver::resolve method.
Parameters
array | $config = [] | Configuration options. |
GuzzleHttp\Promise\PromiseInterface
__invoke (
$previousCredentials = null
)
Constants summary
string |
CRED_PATH
|
#
'meta-data/iam/security-credentials/'
|
string |
TOKEN_PATH
|
#
'api/token'
|
string |
ENV_DISABLE
|
#
'AWS_EC2_METADATA_DISABLED'
|
string |
ENV_TIMEOUT
|
#
'AWS_METADATA_SERVICE_TIMEOUT'
|
string |
ENV_RETRIES
|
#
'AWS_METADATA_SERVICE_NUM_ATTEMPTS'
|
string |
CFG_EC2_METADATA_V1_DISABLED
|
#
'ec2_metadata_v1_disabled'
|
string |
CFG_EC2_METADATA_SERVICE_ENDPOINT
|
#
'ec2_metadata_service_endpoint'
|
string |
CFG_EC2_METADATA_SERVICE_ENDPOINT_MODE
|
#
'ec2_metadata_service_endpoint_mode'
|
float |
DEFAULT_TIMEOUT
|
#
1.0
|
integer |
DEFAULT_RETRIES
|
#
3
|
integer |
DEFAULT_TOKEN_TTL_SECONDS
|
#
21600
|
boolean |
DEFAULT_AWS_EC2_METADATA_V1_DISABLED
|
#
false
|
string |
ENDPOINT_MODE_IPv4
|
#
'IPv4'
|
string |
ENDPOINT_MODE_IPv6
|
#
'IPv6'
|
string |
DEFAULT_METADATA_SERVICE_IPv4_ENDPOINT
|
#
'http://169.254.169.254'
|
string |
DEFAULT_METADATA_SERVICE_IPv6_ENDPOINT
|
#
'http://[fd00:ec2::254]'
|