jcberquist / aws-cfml

Lucee/ColdFusion library for interacting with AWS API's
MIT License
72 stars 53 forks source link

How to put a file to Wasabi S3? #55

Closed artknight closed 2 years ago

artknight commented 3 years ago

I am trying to put a file to s3.wasabisys.com instead of amazon. Their compatibility with Amazon is 100%.

Where is the code below can i specify the different end-point?

aws = new aws(
    awsKey = 'YOUR_PUBLIC_KEY',
    awsSecretKey = 'YOUR_PRIVATE_KEY',
    defaultRegion = 'us-east-1'
);

zipFileData = fileReadBinary('myfile.zip');
aws.s3.putObject(bucket = 'mybucket', objectKey = 'xxxx', fileContent = zipFileData);
jcberquist commented 3 years ago

Hi, you should be able to do this by using the constructorArgs with a host setting for s3:

aws = new aws(
    awsKey = 'YOUR_PUBLIC_KEY',
    awsSecretKey = 'YOUR_PRIVATE_KEY',
    defaultRegion = 'us-east-1',
    constructorArgs = {
        s3: {
            host: 's3.wasabisys.com'
        }
    }
);
artknight commented 2 years ago

@jcberquist perfect! Thank you Sir!

artknight commented 2 years ago

@jcberquist sorry to bother ... is there any way to create folders within buckets? If yes, what would the code for that look like?

jcberquist commented 2 years ago

Have you looked at this? https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html - basically there aren't really any folders on AWS S3 (or an equivalent service) - but you can try putting a zero length object with a key name ending in / to emulate a folder.

artknight commented 2 years ago

Yes Sir, I had found a post talking about it and got it resolved. Thank you!

On Tue, Dec 7, 2021 at 2:30 PM John Berquist @.***> wrote:

Have you looked at this? https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html

  • basically there aren't really any folders on AWS S3 (or an equivalent service) - but you can try putting a zero length object with a key name ending in / to emulate a folder.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/jcberquist/aws-cfml/issues/55#issuecomment-988207502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABGQQRXZTPVHH7KNNTUST3UPZOERANCNFSM5JK6ND7A .