|
1 | | -# Guide to Deploy a Container in AWS |
| 1 | +# AWS Deployment Guide and DevOps Project Hub |
2 | 2 |
|
3 | | -This is a Next.js application that serves as a comprehensive guide for deploying containerized applications on AWS ECS Fargate. It includes a step-by-step workflow, prerequisites, and links to other DevOps projects. |
| 3 | + |
4 | 4 |
|
5 | | -## Features |
| 5 | +This repository contains a Next.js application designed to serve as a comprehensive, interactive guide for deploying containerized applications to AWS ECS Fargate. It documents the entire DevOps lifecycle, from configuring AWS credentials to setting up a CI/CD pipeline with GitHub Actions. |
6 | 6 |
|
7 | | -- **Interactive Guide**: Step-by-step instructions for AWS deployment. |
8 | | -- **Modern UI**: Built with shadcn/ui and Tailwind CSS in a dark theme. |
9 | | -- **Animations**: Smooth workflow animations using Framer Motion. |
10 | | -- **Project Hub**: Links to other DevOps projects. |
| 7 | +The application itself is a hands-on learning tool, featuring a step-by-step workflow visualization, detailed command explanations, and a centralized dashboard for other DevOps projects. |
11 | 8 |
|
12 | | -## Getting Started |
| 9 | +## Project Overview |
13 | 10 |
|
14 | | -First, run the development server: |
| 11 | +The primary goal of this project is to demystify the process of deploying a Dockerized application to the cloud. It breaks down complex AWS tasks into manageable steps, providing visual aids and direct links to necessary resources. |
15 | 12 |
|
16 | | -```bash |
17 | | -npm run dev |
18 | | -``` |
| 13 | +### Key Features |
19 | 14 |
|
20 | | -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 15 | +* **Interactive Deployment Workflow**: A guided experience through the AWS deployment process. |
| 16 | +* **Mobile-Optimized Design**: A responsive interface that works seamlessly on desktop and mobile devices. |
| 17 | +* **Automated CI/CD**: A fully functional GitHub Actions pipeline for continuous deployment. |
| 18 | +* **DevOps Dashboard**: A collection of links to related DevOps initiatives. |
21 | 19 |
|
22 | | -## CI/CD Pipeline (GitHub Actions) |
| 20 | +## Technical Architecture |
23 | 21 |
|
24 | | -This project includes a GitHub Actions workflow (`.github/workflows/deploy.yml`) that automatically builds and deploys the application to AWS ECS whenever changes are pushed to the `main` branch. |
| 22 | +* **Frontend Framework**: Next.js 14 (React) |
| 23 | +* **Styling**: Tailwind CSS |
| 24 | +* **UI Components**: Shadcn/UI, Lucide Icons |
| 25 | +* **Infrastructure**: AWS ECS (Fargate), AWS ECR, AWS IAM |
| 26 | +* **Containerization**: Docker |
| 27 | +* **CI/CD**: GitHub Actions |
25 | 28 |
|
26 | | -### Prerequisites for CI/CD |
27 | | -You must configure the following **Secrets** in your GitHub Repository (Settings > Secrets and variables > Actions): |
| 29 | +## Deployment Walkthrough |
28 | 30 |
|
29 | | -| Secret Name | Description | Example Value | |
30 | | -| :--- | :--- | :--- | |
31 | | -| `AWS_ACCESS_KEY_ID` | Your AWS Access Key ID | `AKIA...` | |
32 | | -| `AWS_SECRET_ACCESS_KEY` | Your AWS Secret Access Key | `wJalr...` | |
33 | | -| `AWS_REGION` | AWS Region | `us-west-2` | |
34 | | -| `ECR_REPOSITORY` | Name of your ECR Repository | `aws-deploy-guide` | |
35 | | -| `ECS_CLUSTER` | Name of your ECS Cluster | `aws-deploy-guide-cluster` | |
36 | | -| `ECS_SERVICE` | Name of your ECS Service | `aws-deploy-guide-task-service` | |
37 | | -| `ECS_TASK_DEFINITION` | Name of your Task Definition Family | `aws-deploy-guide-task` | |
38 | | -| `CONTAINER_NAME` | Name of the container in Task Def | `aws-deploy-guide-container` | |
| 31 | +This section documents every step required to deploy the application, corresponding to the interactive guide within the app. |
39 | 32 |
|
40 | | -### Workflow Stages |
41 | | -1. **Build and Push:** Builds the Docker image and pushes it to Amazon ECR. |
42 | | -2. **Deploy to ECS:** Updates the ECS Task Definition with the new image and deploys it to the ECS Service. |
| 33 | +### 1. AWS Configuration |
43 | 34 |
|
44 | | -## Docker Deployment |
| 35 | +The first step involves setting up the necessary permissions and tools to interact with AWS. |
45 | 36 |
|
46 | | -This project includes a `Dockerfile` to containerize the application. |
| 37 | +**Create Access Keys** |
| 38 | +Generate programmatic access keys in the AWS IAM Console to allow the AWS CLI to authenticate. |
| 39 | + |
47 | 40 |
|
48 | | -### Build the Docker Image |
| 41 | +### 2. Container Registry (ECR) |
49 | 42 |
|
50 | | -```bash |
51 | | -docker build -t aws-deploy-guide . |
52 | | -``` |
| 43 | +Amazon Elastic Container Registry (ECR) is used to store the Docker images. |
53 | 44 |
|
54 | | -### Run the Container Locally |
| 45 | +**Create Repository** |
| 46 | +A new repository is created to host the application image. |
| 47 | + |
55 | 48 |
|
56 | | -```bash |
57 | | -docker run -p 3000:3000 aws-deploy-guide |
58 | | -``` |
| 49 | +**Push Commands** |
| 50 | +The AWS CLI provides specific commands to authenticate Docker and push the image. |
| 51 | + |
59 | 52 |
|
60 | | -Access the application at `http://localhost:3000`. |
| 53 | +**Successful Push** |
| 54 | +Verifying that the image has been successfully uploaded to ECR. |
| 55 | + |
61 | 56 |
|
62 | | -## AWS Deployment Steps (Summary) |
| 57 | +**Repository Content** |
| 58 | +The ECR repository now contains the tagged Docker image. |
| 59 | + |
63 | 60 |
|
64 | | -1. **Login to AWS**: Configure CLI and login to ECR. |
65 | | -2. **Push Image**: Tag and push your Docker image to ECR. |
66 | | -3. **Create Cluster**: Set up an ECS Fargate cluster. |
67 | | -4. **Deploy Service**: Create a task definition and service to run your container. |
68 | | -5. **Access**: Use the public IP assigned to your task. |
| 61 | +### 3. ECS Cluster Setup |
69 | 62 |
|
70 | | -For detailed steps, run the application and follow the interactive guide. |
| 63 | +Amazon Elastic Container Service (ECS) is the orchestration service used to run the containers. |
| 64 | + |
| 65 | +**Cluster Creation Form** |
| 66 | +Configuring a new Fargate cluster in the AWS Console. |
| 67 | + |
| 68 | + |
| 69 | +**Cluster Created** |
| 70 | +The ECS Cluster is successfully provisioned and ready to host services. |
| 71 | + |
| 72 | + |
| 73 | +### 4. Task Definition |
| 74 | + |
| 75 | +The Task Definition serves as a blueprint for the application, specifying the container image, CPU, and memory requirements. |
| 76 | + |
| 77 | +**Configure Task Definition (Step 1)** |
| 78 | +Setting the task family name and infrastructure requirements. |
| 79 | + |
| 80 | + |
| 81 | +**Configure Container (Step 2)** |
| 82 | +Specifying the container details and port mappings. |
| 83 | + |
| 84 | + |
| 85 | +**Select Image URI** |
| 86 | +Using the URI of the image pushed to ECR earlier. |
| 87 | + |
| 88 | + |
| 89 | +**Task Definition Created** |
| 90 | +The task definition is successfully registered. |
| 91 | + |
| 92 | + |
| 93 | +### 5. Service Deployment |
| 94 | + |
| 95 | +The ECS Service maintains the desired number of tasks and handles networking. |
| 96 | + |
| 97 | +**Create Service (Step 1)** |
| 98 | +Defining the service name and desired task count. |
| 99 | + |
| 100 | + |
| 101 | +**Environment Configuration (Step 2)** |
| 102 | +Setting up the deployment type and platform version. |
| 103 | + |
| 104 | + |
| 105 | +**Deployment Settings (Step 3)** |
| 106 | +Configuring deployment strategies (e.g., rolling updates). |
| 107 | + |
| 108 | + |
| 109 | +**Networking (Step 4)** |
| 110 | +Defining the VPC, subnets, and security groups for the service. |
| 111 | + |
| 112 | + |
| 113 | +**Service Created** |
| 114 | +The service is successfully created and begins provisioning tasks. |
| 115 | + |
| 116 | + |
| 117 | +### 6. Verification |
| 118 | + |
| 119 | +Once the service is stable, the application is accessible via the public IP of the Fargate task. |
| 120 | + |
| 121 | +**Access Application** |
| 122 | +The application is live and accessible in the browser. |
| 123 | + |
| 124 | + |
| 125 | +**Deployed Dashboard** |
| 126 | +The live dashboard showing the successful deployment. |
| 127 | + |
| 128 | + |
| 129 | +## CI/CD Pipeline |
| 130 | + |
| 131 | +The project includes a GitHub Actions workflow to automate the build and deploy process. |
| 132 | + |
| 133 | +**GitHub Secrets** |
| 134 | +Securely storing AWS credentials and configuration variables in GitHub. |
| 135 | + |
| 136 | + |
| 137 | +**Workflow Visualization** |
| 138 | +The GitHub Actions interface showing the progress of the build and deploy jobs. |
| 139 | + |
| 140 | + |
| 141 | +### Required Secrets |
| 142 | + |
| 143 | +To enable the CI/CD pipeline, the following secrets must be configured in the GitHub Repository: |
| 144 | + |
| 145 | +* AWS_ACCESS_KEY_ID |
| 146 | +* AWS_SECRET_ACCESS_KEY |
| 147 | +* AWS_REGION |
| 148 | +* ECR_REPOSITORY |
| 149 | +* ECS_CLUSTER |
| 150 | +* ECS_SERVICE |
| 151 | +* ECS_TASK_DEFINITION |
| 152 | +* CONTAINER_NAME |
| 153 | + |
| 154 | +## Educational Project Disclaimer |
| 155 | + |
| 156 | +This is an educational project designed to demonstrate DevOps best practices and modern web development techniques. Anyone is free to fork this repository and modify anything to suit their own learning needs or project requirements. |
0 commit comments