Closed (fixed)
Project:
S3 File System
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Oct 2019 at 03:53 UTC
Updated:
28 Mar 2021 at 07:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mosesliao commentedI tried to do a pull request on drupal git but it doesnt work so I put my own implementation on github instead
https://github.com/liaogz82/s3fs
see if it fits well
Comment #3
zach.bimson commentedI think while not as explicit, the patch attached should do what you're looking for...
Rather than requiring extras config to explicitly define what config provider to use, i suggest we leave this to the defaultProvider and let AWS worry about the logic.
The patch simply checks to see if either the access or secret keys are empty.. if either is, don't define $config['credentials'] at all...
This leaves the heavy lifting to the following...
Aws\Credentials\CredentialProvider::defaultProvider is the default credential provider. This provider is used if you omit a credentials option when creating a client. It first attempts to load credentials from environment variables, then from an .ini file (an .aws/credentials file first, followed by an .aws/config file), and then from an instance profile (EcsCredentials first, followed by Ec2 metadata).
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credent...
I've left `use instance profile` intact but realistically we could remove this and leave it as standard, allowing people to not define credentials at all.
Comment #4
zach.bimson commentedComment #5
munish.kumar commentedHi,
I think, To work this module with fargate, it will be a part of the s3fs module configuration. So while configuring the module developer can also choose this to run with the fargate.
Comment #6
munish.kumar commentedComment #7
munish.kumar commentedComment #8
munish.kumar commentedComment #9
munish.kumar commentedReroll the previous patch as it failed to apply
Comment #11
osopolarhttps://aws.amazon.com/about-aws/whats-new/2020/04/aws-fargate-launches-... says:
So maybe S3FS isn't necessary anymore.
Comment #12
j2I'm not sure why this module is trying to do so much of the heavy lifting with getting credentials. It would work a lot better if it would just call
CredentialProvider::defaultProvider()in the SDK and let the SDK determine where the credentials are living. That would save a lot of headache and make this module more widely usable.Right now it seems like the module is deliberately trying to limit us to using an EC2 box.
Comment #13
darvanenHere's how I did it without any extra code in the module:
Comment #14
osopolar@J2:
Isn't that the way how the patch from zach.bimson in #3 is working? If use_instance_profile and (access_key || secret_key) are not set; as stated in #3:
Anyway, for #3 the function s3fs_requirements() needs to be adjusted.
EDIT:
I guess #3121830: Use CredentialProvider::defaultProvider rather than individual providers is what J2 meant.
EDIT2:
Patch from #9 needs to memoize the credentials, see documentation/example for ecsCredentials provider:
Comment #15
osopolarI investigated a bit more and although #3 is a nice solution, it requires modifications in more places, for example in the install file in function s3fs_requirements() and the validation callback. For now I prefer a similar aproach to #9, adding a new options to the config form, but using CredentialProvider::defaultProvider() instead of CredentialProvider::ecsCredentials(). The patch does not have much in common with #9 therefore I didn't add an interdiff.
I am not sure if we need the option 'Use EC2 Instance Profile Credentials' for backward compatibility, otherwise I would prefer to remove that and have just the default provider as recommended by J2 in #12 and, of course, the credentials in the settings file, which will be necessary (in addition to #3121830: Use CredentialProvider::defaultProvider rather than individual providers), as not all sites are running on amazon infrastructure).
The current solution worked for me. Before removing 'Use EC2 Instance Profile Credentials' I would like to have some feedback. If both options should be kept, I guess it would be better to use radio buttons instead of two checkboxes hiding the other one – but that requires implementing an update hook.
Comment #17
osopolarI missed some checks in S3fsService::validate() and s3fs_requirements().
The test testS3fsConfigurationForm() seems to not work anymore, does it?
Comment #18
osopolarComment #19
osopolar(just restored the issue summary to the state before J2 change)
Comment #20
cmlaraI believe this should be fixed by the changes made in #3121830: Use CredentialProvider::defaultProvider rather than individual providers
That issue is a culmination of information pulled from this issue and several others.