Yesterday, I have written article on an Overview of Amazon Web Services(AWS). In that, I have explained about the Amazon Products and Services. In this article, I will cover the Continuous integration and Continuous Deployment (CI/CD) and how does CICD works on AWS.
What is CICD? (Continuous Integration and Continuous Deployment)
This is service is not very new to the world. This is also known as DevOps(Development Operations) tool.
Whenever you write a code and pass to the QA and move to staging server but there is something not work on the server and in that there is some downtime to solve the issue on the server. But if you have seen in larger companies like Google and Facebook, they don’t have downtime when deploying any new features to the server. For that CICD is useful and it solves the issue of downtime.
Let’s understand the process of CICD and works on AWS.
How does CICD works on AWS?:
First, you are deploying to the development server.Next to the test server and then to the staging or preproduction server. After all works fine, deploy the code to the Production server.
The first stage is called the Development so you need to manage the code base because a couple of developers are working on the development server so you can use the versioning system(Exa, GitHub, SVN) for that. Every developer can download the code and commit the changes when required.
The development server is in a local environment and other servers are on the live server so sometimes the path of images or templates are different and you need to change after the deployment which may go the server in maintenance mode but CICD reduces that time too.
The staging server is identical or mirror copy of Production server so the purpose of staging is if any bug found on a production server, So, first debug the issue on the staging server, try to fix the issue over there and deploy the same code on production. You can also test the user capacity and usage testing on the staging server.Doing something directly to the production is not good so better to use the staging server.
Once your code tested on staging, You can move code the Production.
Overall Process of CICD
Release process has four major phases:
First, come to the source, Source is the source files, this may be JAVA, PHP etc files and also peer review the code and next is the build to prepare the code to deploy, you can do unit testing when you build actually.You can also build containers and image with the help of tools.
After that Test stage and perform all type of testing like functional testing, integration testing, load testing, penetration testing everything and make your code ready to deploy. Once it will pass everything it passes to the Production.CICD helps to write a proper workflow to handle everything automatically.
So we can say this is the overall process of CICD. Next topic is the CICD levels.
Let’s understand the release process levels in CICD.
- CI (Continuous Integration) – Building code base according to deployment
- CD (Continuous delivery) – Delivery up to the test
- CD (Continuous Deployment) – Deployment of the code in production
So These are the ultimately three terms for designing your application, designing of the database also important in CICD. CICD will have less or no downtime as everything will be automatic.
It’s is not easy at all to build this kind of system. You might need to use some tools you build this type of system. Let’s understand some tools useful to build CICD application.
Overall Development Stages
Development: Development environment can be anything. You can use any Operating system. Based on development environment you have different builds.
Version System: You can use any version system like GIT, SVN, Code commit etc. Code commit is nothing but GIT of aws. Code commit price is cheap.
Build: you can use the tool called Jenkins for the build. Jenkins is a tool used to create magic. You can use Jenkins for any technology like JAVA, PHP, PYTHON but build process will be different on technology.you can PHING for PHP project build system and Maven to build java application.
Deploy: Finally, deploy your code. Once Jenkins provides builds, you can deploy your code and Code deploy tool help to deploy your code easily to the server. Code deploy is amazon integration service and it’s free service.Code deploy has very simple utility tutorials and the best part of Code deploy is reverted back. If something goes wrong, you can easily revert the code.
Only code deploys, Jenkins or version system does not work to build CICD process. It will work together and create CICD environment.
How to setup CICD in your application?
Component we are going to use:
- Repository GITHUB
- Jenkins build tools
- Code deploy
These are the things we are going to use, Repository is GitHub, Jenkins is build tool, Jenkins will copy to the S3, S3 is used for zip or xml the file which helpful for profile and code deploy will deploy the code.
Here, Create a two profile, one profile for staging and a second profile for production. Once I select staging profile, it will convert the codebase at a time of build according to the staging server. After testing, I can select production and deploy the code.
Integrated Jenkins for automatic deployment for GIT so whenever to push the code, it will automatically deploy the code. It will automatically detect the changes when to commit the code and understand the new code and create the build and once the build is successful, Jenkins automatically deploy to the production server.
At this stage, I hope you are comfortable with AWS services and CICD process on AWS. In Next article, I will deal with AWS Lambda. If you have any questions regarding how does CICD works on AWS or if you are facing any issues while following the above guide, feel free to let me know via the comments.
Don’t forget to share this guide with other users and your friends!