ihsanashi / shots-ahmadihsan-frontend

A media website filled with photos and videos I've taken, mostly sourced from my Instagram that I deleted a few years back. Built with Next.js, serving files from an AWS S3 bucket, optimised with Cloudinary. Side project | Work in progress
1 stars 0 forks source link

Pull assets from AWS S3 bucket to nextjs project #2

Closed ihsanashi closed 2 years ago

ihsanashi commented 2 years ago
ihsanashi commented 2 years ago

Command for getting all the filenames from a particular folder in an S3 bucket, and saving them to a local file: aws s3api list-objects --bucket your-bucket-name --prefix "example/sub/directory/" > /Users/example/folder/sub/folder/filenames.json

Reference

Original JSON dump from AWS includes the root object for each folder, eg. /instagram/stories, so those were deleted. I also have uploaded metadata files for each folder (photos, stories & videos) to S3 as a backup, these were also included in the JSON dump, and manually deleted in the local JSON file. Also, I removed the first key whose values is the array of objects in each JSON file, eg. "stories" key in stories.json file, to ensure the file is just an array of objects, with no parent key referring to said array.

Then I use jq to manipulate the JSON files to only have the key value pairs that I need.

ihsanashi commented 2 years ago

Supbase Schema

Supabase schema