Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

sitepoint-editors/image-gallery-aws

 
 

Repository files navigation

Overview

This project is aNext.js-based image gallery that fetches images from anAWS API Gateway endpoint and displays them in an attractive frontend. The application is containerized usingDocker, stored inAmazon ECR, and deployed toAWS ECS for scalable hosting.

Features

  • Fetches images from an API Gateway URL
  • Displays images in a responsive gallery
  • Deployed on AWS ECS using a containerized Next.js app
  • Uses Amazon ECR for container storage

Architecture

  1. Frontend: Next.js application
  2. Backend: AWS API Gateway serves image URLs
  3. Containerization: Dockerized Next.js app stored in Amazon ECR
  4. Hosting: ECS Fargate for scalable and serverless deployment

Prerequisites

Before deploying, ensure you have:

  • AWS Account
  • AWS CLI installed and configured
  • Docker installed
  • A Next.js project ready to be containerized
  • API Gateway endpoint for fetching images

Deployment Steps

1. Containerizing the Next.js App

# Build the Next.js projectnpm run build# Create a Docker imagedocker build -t nextjs-image-gallery.# Authenticate Docker with ECRaws ecr get-login-password --region<your-region>| docker login --username AWS --password-stdin<aws_account_id>.dkr.ecr.<your-region>.amazonaws.com# Tag the Docker imagedocker tag nextjs-image-gallery:latest<aws_account_id>.dkr.ecr.<your-region>.amazonaws.com/nextjs-image-gallery:latest# Push to ECRdocker push<aws_account_id>.dkr.ecr.<your-region>.amazonaws.com/nextjs-image-gallery:latest

2. Deploying to ECS via AWS Console

  1. Go toECS ConsoleCreate a Cluster → SelectFargate.
  2. Create aTask Definition with:
    • Task Role:ecsTaskExecutionRole (with ECR access)
    • Container Image:ECR image URL
    • Port Mapping:3000:3000
  3. Create anECS Service under your cluster:
    • Set Task Definition
    • Desired tasks:1 (or more for scaling)
    • Configure Load Balancer if needed
  4. Deploy the service and test the application.

Configuration

  • API Gateway URL: UpdateNEXT_PUBLIC_API_URL in.env.local.
NEXT_PUBLIC_API_URL=https://px893gsmql.execute-api.us-east-1.amazonaws.com/images
  • Port Configuration: EnsureEXPOSE 3000 is set inDockerfile.

Future Enhancements

  • Implement CI/CD pipeline with AWS CodePipeline
  • Add caching mechanism for faster image loading
  • Use AWS CloudFront for global content delivery

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS37.3%
  • Python33.3%
  • JavaScript24.3%
  • Dockerfile5.1%

[8]ページ先頭

©2009-2025 Movatter.jp