I have an issue on getting credentials after upgrading from 2nd version to 3rd.
My service gets credentials from metaserver and cache them in file.
Here is how service definition looks like on 2nd version:
my_app.infrastructure.s3.client.credentials_cache.adapter:
class: DoctrineCommonCacheFilesystemCache
public: false
arguments:
- '%kernel.cache_dir%/aws_credentials'
my_app.infrastructure.s3.client.credentials_cache:
class: GuzzleCacheDoctrineCacheAdapter
public: false
arguments:
- '@my_app.infrastructure.s3.client.credentials_cache.adapter'
my_app.infrastructure.s3.client:
class: AwsS3S3Client
factory: [ 'AwsS3S3Client', 'factory' ]
arguments:
- region: "%my_app_organization_dictionary_aws_s3_region%"
credentials.cache: '@my_app.infrastructure.s3.client.credentials_cache'
with that config it works for a while, after upgrading I changed a way how to cache credentials from meta server.
my_app.infrastructure.s3.client.credentials_cache.adapter:
class: DoctrineCommonCacheFilesystemCache
public: false
arguments:
- '%kernel.cache_dir%/aws_credentials'
my_app.infrastructure.s3.client.credentials_cache:
class: AwsDoctrineCacheAdapter
public: false
arguments:
- '@my_app.infrastructure.s3.client.credentials_cache.adapter'
my_app.infrastructure.s3.client.credentials_provider:
class: AwsCredentialsCredentialProvider
factory: [ 'AwsCredentialsCredentialProvider', 'defaultProvider' ]
public: false
my_app.infrastructure.s3.client.cached_credentials_provider:
class: AwsCredentialsCredentialProvider
factory: [ 'AwsCredentialsCredentialProvider', 'cache' ]
arguments:
- '@my_app.infrastructure.s3.client.credentials_provider'
- '@my_app.infrastructure.s3.client.credentials_cache'
public: false
my_app.infrastructure.s3.client:
class: AwsS3S3Client
factory: [ 'AwsS3S3Client', 'factory' ]
arguments:
- region: "%my_app_organization_dictionary_aws_s3_region%"
version: 'latest'
credentials: '@my_app.infrastructure.s3.client.cached_credentials_provider'
but still get an error
FAIL AWS S3: Fail check the AWS S3 with bucket "my_app_bucket".
Reason: [AwsExceptionCredentialsException]
Error retrieving credentials from the instance profile metadata server.
(cURL error 28: Operation timed out after 1001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://169.254.169.254/latest/api/token).
Any ideas on what’s wrong with my setup?