Ticker

6/recent/ticker-posts

Deploy a web application to ElasticBeanstalk using cloudformation and GitLab Pipeline or CodeBuild

 

Objective:

  • The aim of this blog is to provide simple and clear steps to deploy a web application to AWS ElasticBeanstalk using AWS Cloudformation and GitLab Pipeline or using codebuild.
  • I intentionally have chosen not to include the RDS template as part of the CI/CD pipeline, considering it as part of the architecture diagram. This decision was based on the best practice of managing it separately from the pipeline lifecycle.
  • Also you will learn to use .ebextensions to configure with your code to do some great stuffs like monitoring Memory, setting up some nginx custom configuration and enabling cross zone.


Prerequisite:

  • A S3 bucket to store artifacts
  • Networking resources i.e VPC, subnets, etc (ref)
  • Repository setup with Web app code
  • Setup GitLab runner (ref) Reference URL has been shown on the setting up GitLab runner on k8s cluster however you can chose to use linux instance as well.

GitHub Repo Link:


Project Folder Structure:



Architecture diagram:


STEPS:

  1. Write .gitlab-ci.yml for GitLab pipeline and buildspec.yml for CodeBuild
  2. Setup the runner and give runner tag as aws
  3. Commit the code to development branch


.gitlab-ci.yml Content:


buildspec.yml Content:




Thanks for Reading!!

Post a Comment

0 Comments