{"id":19807016,"url":"https://github.com/kennedy-whytech/imagegallery-fastapi","last_synced_at":"2026-04-29T22:37:35.186Z","repository":{"id":165635702,"uuid":"602221569","full_name":"kennedy-whytech/ImageGallery-fastapi","owner":"kennedy-whytech","description":"A simple image gallery web via Fast-api with local S3 \u0026 Dynamodb.","archived":false,"fork":false,"pushed_at":"2023-03-13T21:06:04.000Z","size":565,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-17T16:29:56.544Z","etag":null,"topics":["applicationdevelopment","aws","cloudformation","docker","dynamodb","fastapi","imagegallery","local","s3","testing"],"latest_commit_sha":null,"homepage":"https://medium.com/@kennedy.whytech/imagegallery-fastapi-a-simple-image-gallery-app-with-fastapi-local-s3-and-dynamodb-9c708c8c6e4b","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kennedy-whytech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-15T18:50:26.000Z","updated_at":"2023-02-22T16:35:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"eedd5bbe-ce26-493e-a090-40164a90d2fd","html_url":"https://github.com/kennedy-whytech/ImageGallery-fastapi","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"a474fe6fe2c052746723e66da2a10426bf0fdf35"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kennedy-whytech/ImageGallery-fastapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennedy-whytech%2FImageGallery-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennedy-whytech%2FImageGallery-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennedy-whytech%2FImageGallery-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennedy-whytech%2FImageGallery-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kennedy-whytech","download_url":"https://codeload.github.com/kennedy-whytech/ImageGallery-fastapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennedy-whytech%2FImageGallery-fastapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32447290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["applicationdevelopment","aws","cloudformation","docker","dynamodb","fastapi","imagegallery","local","s3","testing"],"created_at":"2024-11-12T09:09:16.824Z","updated_at":"2026-04-29T22:37:35.153Z","avatar_url":"https://github.com/kennedy-whytech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImageGallery-fastapi\n\n## Summary\nA simple image gallery web via Fast-api with local S3 \u0026 Dynamodb. \n\nThe objective of the project is to test a web app locally in a simulated environment like on AWS. Next, all necessary resoruces will be created via AWS Cloudformation. The dockerized web app will be run in an EC2 instance connected to Dyanmo \u0026 S3. \n\nAs a developer, testing apps locally in a simulated environment like AWS can be useful in shortening deployment time. Deploying apps to cloud platforms can often require separate deployment teams, so it’s crucial for developers to have a reliable local testing environment.\n\nThis is where the ImageGallery-fastapi app comes in handy. The app is a simple image gallery web application with local S3 and DynamoDB. You can follow the structure to develop your own apps easily! =]\n\n![plot](./image/ui_ref_new.png)\n\n![plot](./image/ArchitectureDiagram.png)\n\n## TL;DW\n1. Make sure you have setup $HOME/.aws/credentials. It can be just a dumpy credential locally\n\n2. Run the app locally with docker-compose. Remember to shutdown servcies before each rerun e.g \n```\ndocker-compose down\ndocker-compose up\n```\nNow, you can visit the web app on localhost:8006 from your browser! \n\n3. After each modificaiton on the app. Build the image again and repeat the step 2 e.g\n```\ndocker build --no-cache -t kennedydocker/gallery_fast_api:latest .\n```\n\nTo follow the same structure for your own apps, you can modify the gallery_fast_api service in the [docker-compose.yml](https://github.com/kennedy-whytech/ImageGallery-fastapi/blob/a36e71c3f32a8f3a806ceac27e21bff2950e54ec/docker-compose.yml#L39) e.g replace the image repo with your own one.\n\n\n## Setup local dyanmodb, s3 and fast-api app individually \n### Setup local dyanmodb. \nFiles will be written to memory only. Table content can be reviewed via a local dynamodb-admin gui\n```\ndocker run -d -p 8000:8000 --name local-dynamodb amazon/dynamodb-local\ndocker logs -f local-dynamodb\nnpm install -g dynamodb-admin\ndynamodb-admin\n```\nThen visit http://localhost:8001/ to visit check the dynamodb at the admin portal\n\nREF:\n\nhttps://hub.docker.com/r/amazon/dynamodb-local\nhttps://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html\n\n### Setup local s3\n```\ndocker run -p 9090:9090 -p 9191:9191 -e initialBuckets=test -e debug=true -t adobe/s3mock\n```\nREF:\n\nhttps://github.com/adobe/S3Mock\n\n### Setup the fast-api app without docker. \nThis can useful, since --network host may not work in your machine during testing\n```\nuvicorn main:app --port 8006 --reload \n```\n\nAlernatively, run it with docker on non-mac machine.  --network host can be used. As mentioned, configure your $HOME/.aws/credentials, so that it can be binded to the container\n```\ndocker build -t kennedydocker/gallery_fast_api:latest .\ndocker run --network host  -e ENV_NAME=development -e ORI_IMAGES_BUCKET=oriimagesbucket7566 -e RESIZED_IMAGES_BUCKET=resizedimagesbucket7566 -e DYANMODB_TABLE_NAME=image_meta --mount type=bind,source=$HOME/.aws,target=/root/.aws,readonly kennedydocker/gallery_fast_api:latest\n```\n\nWith the above instructions, you should be able to run the app locally. Enjoy testing with the app locally!!\n\n##  AWS production deployment\n### The cloudformation stack will be in another repo.\n\n### publish it to dockerhub e.g\n```\ndocker build --no-cache -t kennedydocker/gallery_fast_api:latest .\ndocker push kennedydocker/gallery_fast_api:latest\n```\n\n### AWS setup\nPrerequisite\n1. create s3 buckets with appropriate policies and rules\n2. create dynamodb table with appropriate essential policies and rules\n3. create cloudformation stack\n\nThe setup script is actually recorded in UserData in cloudformation stack. FYI, on EC2, you can run the following:\n```\ndocker run -e ENV_NAME=production -e ORI_IMAGES_BUCKET=oriimagesbucket7566 -e RESIZED_IMAGES_BUCKET=resizedimagesbucket7566 -e DYANMODB_TABLE_NAME=image_meta -p 8006:8006 kennedydocker/gallery_fast_api:latest\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennedy-whytech%2Fimagegallery-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkennedy-whytech%2Fimagegallery-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennedy-whytech%2Fimagegallery-fastapi/lists"}