Some questions regarding AWS S3 config - I have `t...
# cfml-general
d
Some questions regarding AWS S3 config - I have
this_._s3_._accessKeyId
and
this.s3.awsSecretKey
set in Application.cfc and then in a service cfc I am calling the Lucee function
s3readBinary()
This function expects: bucketName, objectName, accessKeyId, secretAccessKey. First question: If I don't include the accessKeyId and secretAccessKey in the s3readBinary() call will it use the config from Application.cfc. If not, how do I access those variables in my service cfc without having to also put them in the Application scope.
According to the docs you can use
lucee.s3.accesskeyid
but is that the same as setting
this.s3.accessKeyId
?
Have just tried adding this.s3.accessKeyId and this.s3.secretAccessKey to Application.cfc and then removing them from the s3readbinary() call and I see a 'missing S3 credentials' error with a note to use this.s3... in Application.cfc - have restarted the server, so looks like I have to put them in the App scope and add them back in.
s
maybe not helpful, but in the interests of decoupling S3 functionality from the app server, we prefer https://forgebox.io/view/s3sdk to the lucee extension (though my understanding is that it's one of the better used and better supported extensions, I just don't see an advantage to making it one vs. a CF library)
d
Thanks @sknowlton I'll take a look at the library as it may be a better way to go.
p
Go the decoupling route, way smoother.
d
I have already built most of the implementation just need to get these s3 access key and secret into the service cfc. For the time being have opted to copy into the Application scope and reference them that way. We'll be rebuilding this aspect in due course and I can then implement the s3sdk in the next iteration. Have it working now, even if a little clunkier than I would like.
g
Commit any sins required to get it working... Just make sure you leave yourself a TODO comment in the code about how you "want" it to be. If you're using a ticketing system - create a ticket from the TODO, too. (just so you c an keep some visibility about the "shortcut" you've taken.
👍 1