Closed freiguy1 closed 3 years ago
After looking at this repo's code a bit more, perhaps the resolution of correct credentials it out of scope. For instance the IAmazonS3
class does none of this credentials resolution. I guess the verbose code I need to set a AmazonS3EncryptionClientV2
up that works on all our environments was bothering me.
Hi @freiguy1,
Good afternoon.
Based on your latest comment above, should this issue be closed?
Thanks, Ashish
I will close it, but I'd like to get some guidance about the code above being correct for instantiating a AmazonS3EncriptionClientV2
with correct credentials?
The title pretty much says it. Other services are much easier to create. They evaluate several rules for how to resolve credentials. Here's some code:
In my appsettings.Development.json, I've set these:
First, the
AmazonS3CryptoConfigurationV2
doesn't correctly find my region. So I have to set it like:The
if
statement is needed because environment variables are used in other environments. Only appsettings when developing locally.s3Configuration
is anAWSOptions
which I get from theIConfiguration.GetAWSOptions()
extension method.Next, it doesn't respect my
Profile
in appsettings. It uses[default]
credentials. I've gotten around this byAll of this is simply done in one line with typical services:
Could you maybe just create a new constructor that takes an
IAmazonS3
and wraps it? Otherwise perhaps this code could be helpful to resolve credentials.Also, perhaps I'm just doing something completely wrong. Let me know!