Skip to content
Advertisement

Lambda Function to write to csv and upload to S3

I have a Python Script that gets the details of the unused security groups. I want that to write into a CSV file and upload to S3 Bucket.

When I test it in local machine it writes to CSV in the local machine. But when I execute that as a lambda function, it needs a place to save the CSV. So I am using s3.

JavaScript

I want to write the result of “elem” into csv file and upload to S3 Bucket. Kindly advice.

Advertisement

Answer

By using StringIO(), you don’t need to save the csv to local and just upload the IO to S3. Try my code and let me know if something wrong because I can’t test the code but it was worked for other cases.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement