> For the complete documentation index, see [llms.txt](https://lakshya-project.gitbook.io/microservice-project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lakshya-project.gitbook.io/microservice-project/11-microservice-cicd-pipeline-using-jenkins-eks-and-cloudformation.md).

# 🤓11 Microservice CICD Pipeline using Jenkins, EKS and CloudFormation

&#x20;

### **Prerequisites** <a href="#prerequisites" id="prerequisites"></a>

1. Linux and basic commands.
2. General knowledge of the cloud, containerization and the above tools would be good to start. (No issues if you are new to it, you will learn along the way.

***

### What is DevOps? <a href="#what-is-devops" id="what-is-devops"></a>

#### Development + Operations 🎉 <a href="#development--operations" id="development--operations"></a>

DevOps is a set of practices that combines software development and IT operations. It aims to shorten the systems development life cycle and provide continuous delivery with high software quality.

**Understanding Microservices Architecture**

Microservices architecture is a design approach where a single application is broken down into smaller, loosely coupled services that can be developed, deployed, and scaled independently. This modular structure enhances agility and scalability in software development.

**Importance of Continuous Integration and Continuous Deployment**

Continuous Integration (CI) and Continuous Deployment (CD) are crucial practices in modern software development. They promote automated testing, code integration, and deployment, leading to faster delivery, reduced errors, and improved collaboration among developers.

**Overview of Jenkins, EKS, and CloudFormation**

Jenkins is a popular automation server that facilitates CI/CD processes. Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes service for container orchestration, while CloudFormation enables the creation and management of AWS resources through code.

***

{% hint style="success" %}
**Let's Get Started**
{% endhint %}

To start we need to have source code you can either use yours if you have one or download/clone my ***GITHUB*** basic project. You can clone/use my [project ](https://github.com/Lakshyanama/Microservice-Project.git)if you don't have one.

### First Create a user in AWS IAM with any name

\
Attach Policies to the newly created user

<figure><img src="/files/04KeNCd79qphHVem5VFv" alt=""><figcaption></figcaption></figure>

\
AmazonEC2FullAccess

AmazonEKS\_CNI\_Policy

AmazonEKSClusterPolicy

AmazonEKSWorkerNodePolicy

AWSCloudFormationFullAccess

IAMFullAccess

**One more policy we need to create with content as below**

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "eks:*",
            "Resource": "*"
        }
    ]
}
```

***

Now we are going to launch Ubuntu instances:

### Let's Launch EC2 instances ☁️(amazon Linux image) <a href="#lets-launch-ec2-instances-amazon-linux-image" id="lets-launch-ec2-instances-amazon-linux-image"></a>

1. Log into the [AWS console](https://aws.amazon.com/console/) & select EC2 service. ![](https://nasi-chaudari.gitbook.io/~gitbook/image?url=https:%2F%2F2593464885-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F3DMI85ymmo2BqduKTK9p%252Fuploads%252FDeSg4bLE5mfVhqJdtZA0%252FEC2-3-1.png%3Falt=media%26token=84abafde-d2c7-40c7-af7d-4d856b3de026\&width=300\&dpr=4\&quality=100\&sign=0e2218c2a868ee29a68b151e2d265341addaf9f12748b85456bb0e715fd538c3)
2. Click on Launch instance
3. You will see a window with Amazon machine images(AMI) full of different operating systems and readymade software or CMS like WordPress but SELECT the ***Ubuntu***
4. Choose **t2.large**&#x20;
5. Now add storage (up to 25 GB) >> NO need for Storage >> Add Tags for clear identification: Name \<tab>microservice >> In the SECURITY GROUP window we have to open some ports like  **8080** for *Jenkins* and port **22** for *SSH* and some more port and click "**Review and Launch" >> LAUNCH >**> If you are a new user in new user and don't have any KeyPairs (needed for SSH login) download a KeyPair (name the key "DevOps Key" for reference 👍) >> Keep the .pem file safe we might need it.
6. ![](/files/R6ionsNydw9WvC4Yp943)
7. Your Instance will be launched and you will see a window with an instance in a pending state. ![](/files/386794qMJZnadDPs8XkM)
8. Wait for a few minutes and it will get Running with status checks passed 2/2

***
