I have a list of keys that I retrieve from the cache, and I want to load related objects (files) from S3 without having to make a key request.
Assuming I have the following key array:
key_array = [
'20160901_0750_7c05da39_INCIDENT_MANIFEST.json',
'20161207_230312_ZX1G222ZS3_INCIDENT_MANIFEST.json',
'20161211_131407_ZX1G222ZS3_INCIDENT_MANIFEST.json',
'20161211_145342_ZX1G222ZS3_INCIDENT_MANIFEST.json',
'20161211_170600_FA68T0303607_INCIDENT_MANIFEST.json'
]
I am trying to do something similar to this answer to another SO question, but it has changed like this:
import boto3
s3 = boto3.resource('s3')
incidents = s3.Bucket(my_incident_bucket).objects(key_array)
for incident in incidents:
incident_body = incident['Body'].read().decode('utf-8')
My ultimate goal is that I would like to avoid using the AWS API separately for each key in the list. I would also like to avoid having to pull out the entire bucket and filter / correct the full results.
source
share