I'm trying to figure out the best way to manage image uploads for my website. I've heard that using S3 with CloudFront for storage and CDN is a good option, but I need more insight from a developer's perspective. Should I embed images directly into the app's code and include them in the build, or is it better to keep them separate in a service like S3? If I decide to use S3, how do uploads work? Do I have to provide my team access to the AWS console to upload images directly, or would it be better to give them access to upload from their local machines using CLI commands? Both options seem a bit cumbersome. Is there a simpler method for managing image uploads, or would including them in the initial build be the way to go?
3 Answers
It really depends on the type of app you're working on. If you're planning to use AWS, you could set up a src/images folder, then utilize the AWS CLI to transfer images to your CloudFront S3 site. What's the architecture you're using? Are you employing CDK or click ops for your deployment?
If your app is a static front-end, you might want to consider hosting everything directly on S3 instead of using Fargate. In that case, your images could be served right out of S3 without extra steps. However, if using containers makes more sense, bundling the images with your app can be the easiest route. Just remember, you can still cache those images using a CDN for better performance.
You can upload static content like images into the S3 bucket configured with CloudFront. This can either be part of your app deployment process or a separate step altogether. If set up properly, there's no need to include static content in your application bundle. You could set up CloudFront to send dynamic requests to your application while serving static assets directly from S3, which simplifies things a lot!
We’re looking at a setup where the app will be containerized in our GitLab pipeline and deployed to ECS with Fargate. We're also planning to manage infrastructure using Terraform.