Today I Learned

Searching for files in AWS s3 from rails console

first set your credentials to AWS_ACCESS_KEY_ID, AWS_REGION, AWS_SECRET_ACCESS_KEY in .env


rails c
s3_client =

if credentials are set it will by default look for them there, but there is much more other options

then we can

    bucket: 'S3_BUCKET',
    max_keys: 'max_records by def 1000',
    prefix: 'some/key/to/file/'

It is good to note that prefix doesn’t begin from ‘/‘

also it works from ‘aws-sdk’ > 2.3.2