Posts

Showing posts with the label deployment

Guide to Setting Up CI/CD for NextJS with Jenkins, Gitlab, and AWS ECS

Image
Introduction In the previous article, I provided instructions on setting up CI/CD with Jenkins and Gitlab to deploy a NestJS project to AWS EKS. Now, I will provide similar guidance for deploying a project using the NextJS framework to AWS ECS, triggering an auto build on Jenkins when pushing code to Gitlab, and running tests for the project before deployment. A summary of the steps involved will be as follows: Build the Docker image for the NextJS project and push it to AWS ECR. Deploy that Docker image to AWS ECS. Set up Jenkins to connect with Gitlab. When code is pushed to Gitlab, Jenkins will trigger an auto build of the steps defined in the Jenkinsfile, including: Pulling the new code from Gitlab. Running tests for the project. If the test fails, stop the deployment process. If the test passes, proceed to the next step. Building the Docker image with the new code and pushing it to AWS ECR. Deploying to AWS ECS by restarting the service, which will use the latest Docker image to d...

Guide to deploying NextJS on AWS ECS

Image
Introduction I already have an article guiding the deployment of a project using the NestJS framework on AWS ECS, while in this article we will go through how to deploy a frontend project using the NextJS framework also deploying on AWS ECS, the difference is mostly concentrated in building the docker image, as long as you can build the docker image and push successfully to AWS ECR, the next steps are almost identical Prerequisites Because there was a previous article providing quite comprehensive guidance on AWS ECS, in this article I might not instruct in detail about it much more, if there is any information that is not clear you can review previous articles to understand better The goal of the article is to concentrate on the deployment so I will not dive deep into coding NextJS but will reuse from previous articles, you can also use a similar project according to your own needs Detail First of all, let's update the next.config.ts file to support standalone mode import type {...

Setting Up IAM Roles Anywhere instead of Access Keys in AWS

Image
Introduction Setting up IAM Roles Anywhere is the "gold standard" for bringing the power of IAM Roles to external servers (On-premises, Azure, GCP) without needing permanent, risky Access Keys. This mechanism relies on PKI (Public Key Infrastructure): You use a digital certificate to prove your identity to AWS, and in return, AWS provides you with temporary, short-lived credentials. Prerequisites Before we begin, you should have a basic understanding of IAM Identity Center and how to set up AWS Access Keys/Secrets, as this guide builds upon those concepts. Quick Recap If you have already set up a profile and logged in via SSO, you would typically use that profile in a NestJS source code like this: import { Injectable } from '@nestjs/common' import { getSignedUrl } from '@aws-sdk/s3-request-presigner' import { ConfigService } from '@nestjs/config' import {   S3Client ,   ListObjectsV2Command ,   GetObjectCommand , } from '@aws-sdk/client-s3...