# Creating a Pipeline between Github action and EC2 instance for building a docker image and network

> **Contents:**  
> [Introduction](#818c)  
> [Establish a pipeline between Github and EC2 instance.](#02fb)

The definition of a pipeline with regard to DevOps must first be understood in order for us to comprehend the design of a pipeline fully.

A pipeline is a group of automated procedures or tools that developers use to create and release code into a live environment. Generally speaking, a pipeline consists of three primary parts:

Build automation/continuous integration

*   Test automation
*   Deploy automation

It generally contains a set of tools that are divided into the following parts :

*   Source Control
*   Build tools
*   Containerization
*   Configuration Management
*   Monitoring

***Let’s go on and see how to use the procedures listed below to establish a pipeline between a GitHub activity and an EC2 instance:***

1.  Open the **AWS site** and log in with your credentials using the URL below:

[**Cloud Computing Services - Amazon Web Services (AWS)**  
*Whether you're looking for computing power, database storage, content delivery, or other functionality, AWS has the…*aws.amazon.com](https://aws.amazon.com/ "https://aws.amazon.com/")[](https://aws.amazon.com/)

2\. Create an **IAM user**, role, and policy additions to accompany it. To add a new user, click the add **new user** button now.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051417387/38b511ce-573d-448b-9a3c-8726b73a2d39.png)

Click on Access Management

3\. After that click on the next option.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051418978/049fa3aa-68a8-4a36-ae8c-b1a9823fd208.png)

Add a User

4\. Now review the user permission and all page will appear.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051420771/da8291ea-839d-4e30-8bc7-aaaa73712c27.png)

Review the permissions

5\. Next step is to download the CSV file for future use.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051422124/089ab255-7f25-4cc5-95df-ef679986852c.png)

Save the CSV file

6\. Create a role now, add a policy, and provide **AmazonEC2FullAccess** access.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051423561/164b5cd0-b75a-41d5-8333-d86465af0714.png)

Give Access

7\. Select your IAM profile after this and launch the instance.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051425480/d49a750c-45a5-4000-992a-ea5d21395b4c.png)

Select the IAM profile

8\. Go to **action** \-> **runners script** in the **repository\_settings** and follow the instructions on the window. Keep in mind that the runner's key is crucial during setup.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051427255/ba32ee3c-9735-4f42-a83a-d30a463a21d3.png)

Do the changes

9\. Now Create a workflow using the GitHub repository’s action menu.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051428915/1f9d5b70-2548-41b0-844c-c94af599fa1a.png)

Actions Menu

10\. Now Select **set up a workflow yourself** in the New Workflow.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051430528/8309fb85-5143-4acb-a996-7640d148dfe2.png)

Choose a Workflow

11\. Create the **main.yml** file and write the code over here.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051432261/aa0e5c48-c980-45e4-86c8-91a90ac5dc6c.png)

Main.yml

12\. The main.yml code is as follows:

> I hope this article was informative and provided you with the details you required. If you have any questions related to Python or Azure Development, Coding, Blogging, or Tech Documentation while reading the blog, message me on [Instagram](https://www.instagram.com/acanubhav94/) or [LinkedIn](https://www.linkedin.com/in/anubhav-chaturvedi-a7465a72/). For any kind of work related to DevOps, Site Reliability you can contact me at [helpmeanubhav@gmail.com](mailto:helpmeanubhav@gmail.com) **Special credits to my team members:** [**Heet**](https://www.linkedin.com/in/heet-doshi-01126522a/) **and** [**Anshika**](https://www.linkedin.com/in/anshika-yadav-0a69381b7/)**.**

> Thank You…
