Table of contents
In this project, we are going to use AWS services to fetch our code, build it and deploy it on AWS Elastic Beanstalk.
For this project, we’ll be making use of the following services
AWS Elastic Beanstalk: environment to deploy and manage the application.
AWS Relational Database Service (RDS): managed database for the application.
GitHub Repository: git-based repository hosting the source code.
AWS CodeBuild: managed service to fetch the source code from Bitbucket and build an artifact.
AWS S3: to store the artifact.
AWS CodePipeline: CI/CD service to automate the release process.
Project Architecture
Project Implementation
Step 1: Setup AWS Beanstalk
Create key pair to use to login to the beanstalk instance
-
Create IAM role for Beanstalk
-
Create Beanstalk application
Step 2: Setup AWS RDS
Setup connection between the EC2 instances created by Beanstalk and RDS
make RDS security group allow connections from the EC2 instances
verify connection to the RDS instance from Beanstalk instance
setup tables in the RDS accounts database
Step 3: Setup AWS Code Build
Create S3 bucket to store artifact
Create Code Build project
buildspec yaml
version: 0.2 phases: install: runtime-versions: java: corretto17 pre_build: commands: - apt-get update - apt-get install -y jq - wget https://archive.apache.org/dist/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz - tar xzf apache-maven-3.9.8-bin.tar.gz - ln -s apache-maven-3.9.8 maven - sed -i 's/jdbc.password=admin123/jdbc.password=ntGHNQm3OLhzZ32Scxge/' src/main/resources/application.properties - sed -i 's/jdbc.username=admin/jdbc.username=admin/' src/main/resources/application.properties - sed -i 's/db01:3306/awscicd.c32i2026eovy.us-east-1.rds.amazonaws.com:3306/' src/main/resources/application.properties build: commands: - mvn install post_build: commands: - mvn package artifacts: files: - '**/*' base-directory: 'target/vprofile-v2'
Test build project
Step 4: Setup AWS Code Pipeline
Create pipeline
Step 5: CI/CD process initial trigger
Application successfully deployed to Beanstalk
Step 6: Test automated CI/CD through github trigger
edit source code
pipeline automatically triggered
VOILA!!! QED!!!