amazon-s3

Find all JSON files within S3 Bucket

Find all JSON files within S3 Bucket Question: is it possible to find all .json files within S3 bucket where the bucket itself can have multiple sub-directories ? Actually my bucket includes multiple sub-directories where i would like to collect all JSON files inside it in order to iterate over them and parse specific key/values. …

Total answers: 1

MIDIutil write MIDI File to boto3 API server via Flask [Python]

MIDIutil write MIDI File to boto3 API server via Flask [Python] Question: struggling with trying to write a MIDIUtil file in my Flask App connecting to an s3 server. In a local instance, it’s no sweat: LOCAL_UPLOAD_FOLDER = ‘./_static/uploads/MIDI_files/’ file_name = "NAME.mid" file_path = f'{LOCAL_UPLOAD_FOLDER}{file_name}’ MyMIDI = MIDIFile(1) with open(file_path, "wb") as output_file: MyMIDI.writeFile(output_file) However, …

Total answers: 2

S3 Upload Invoke Lambda Fails – Cross Account Access

S3 Upload Invoke Lambda Fails – Cross Account Access Question: I have a lambda that triggers off an S3 bucket upload (it basically converts a PDF to a dataframe and writes it to a different s3 bucket). Both of these belong to AWS account A. I would like to allow cross-account s3 access to trigger …

Total answers: 3

AWS CLI Can List S3 Bucket But Access Denied For Python Lambda

AWS CLI Can List S3 Bucket But Access Denied For Python Lambda Question: I’ve used terraform to setup infra for an s3 bucket and my containerised lambda. I want to trigger the lambda to list the items in my s3 bucket. When I run the aws cli it’s fine: aws s3 ls returns 2022-11-08 23:04:19 …

Total answers: 2

AWS S3 downloading the HTML file instead of serving it

AWS S3 downloading the HTML file instead of serving it Question: I’m trying to serve an HTML page after generating it with my code, so every time I run my code, it will generate a new index.html file. And after that, I have to create a URL for this page like this: file_name = ‘index.html’ …

Total answers: 1

Getting _register_s3_control_events() Error

Getting _register_s3_control_events() Error Question: I am trying to read a csv from an S3 bucket using my jupyter notebook. I have previously read this csv before and had no issues but now am receiving an error. Here is the code I am running: import pandas as pd list = pd.read_csv(r’s3://analytics/wordlist.csv’) And the error I am …

Total answers: 1

How to get filenames list from S3 bucket using Boto3

How to get filenames list from S3 bucket using Boto3 Question: How to get a list of all the filenames present in the s3 bucket. import boto3 import pandas as pd s3 = boto3.client(‘s3′) s3 = boto3.resource( service_name=’s3′, region_name=’us’, aws_access_key_id=’pjh’, aws_secret_access_key=’mm’) ob = [] for i in s3.Bucket(‘xyzbucket’).objects.all(): ob.append(i) test= [] for i in ob: …

Total answers: 1

Tagging S3 bucket object Issue

Tagging S3 bucket object Issue Question: I am trying to add tags to existing object in S3 bucket using Lambda. Lambda has IAM role permission to add tags to bucket object, however simple python code to get_object_tagging is working but put_object_tagging is not working. client = boto3.client("s3") tagresponse = client.put_object_tagging( Bucket="mybucket, Key="folder1/Test.txt", Tagging={‘TagSet’:[{‘key’:’:permission:allowdownload’,’Value’:’no’},{‘key’:’service:feature’,’Value’:’sftpfiletransfer’}]}, ) API …

Total answers: 1

Downloading file with a specific substring from AWS S3 python

Downloading file with a specific substring from AWS S3 python Question: I have a python function to download csv files from AWS S3 Bucket. The folder I want to download from has a lot of csv files with various naming conventions and out of all those, I want to download files that contain a certain …

Total answers: 1