A Cloud Architect Company
Amazon Web Services

How to setup CI/CD pipeline to automate build and deploy ecs through bitbucket pipelines

INTRODUCTION:

In this article we are going to setup CI/CD pipeline to automate build and deploy ecs through bitbucket pipelines Bitbucket Pipelines is a continuous integration and continuous deployment (CI/CD) service provided by Atlassian’s Bitbucket, which is a Git repository hosting service. With Bitbucket Pipelines, you can automatically build, test, and deploy your code every time you push updates to your repository. It’s configured using a YAML file (bitbucket-pipelines.yml) that lives in the root of your repository. This file defines the steps your pipeline will take, such as installing dependencies, running tests, and deploying your application.

If you would like to follow a video tutorial please use our YouTube video.

WHAT IS ECS:

ECS is a fully managed container orchestration service provided by Amazon Web Services. It enables you to run, stop, and manage Docker containers on a cluster of virtual machines that are managed by AWS. ECS simplifies the process of deploying, managing, and scaling containerized applications.

WHAT IS ECR:

ECR is a fully managed Docker container registry service provided by Amazon Web Services. It allows you to store, manage, and deploy Docker container images securely. ECR is tightly integrated with other AWS services, particularly Amazon ECS and Amazon Elastic Kubernetes Service, making it easy to deploy containerized applications on AWS infrastructure.

PREREQUISITES:

  • AWS account.
  • AWS account with ecr and ecs full access.
  • Basic knowledge about Bitbucket pipelines.

INTENDED AUDIENCE:

  • Engineer

BITBUCKET PIPELINE:

Go to the bitbucket repository where you have the source code of React js > go inside the repository settings.

Repository settings

In pipeline select settings > enable the pipelines.

Enable pipeline

Go to the repository variables > add access and secret access key of the user you created.

Repository variables

Go inside Deployments > add region, access and secret access key and variables of ecs and ecr

Deployments

click on pipelines

pipelines

click on run pipeline > select main branch > Run.

Run pipeline

 

Build and Deploy

ECS is successfully build and deployed.

Go inside ECS Console > go inside the cluster > go inside the task and copy the public ip.

copy task public ip

 

React js app

React js is successfully deployed.

Now lets change the source code and see whether the pipeline is auto triggered or not > click commit.

Changing source code

Go to pipelines > you can see that the pipeline got auto triggered and running.

pipeline Auto triggered

Go inside the pipeline which is running.

Build and Deployed

ECS is successfully build and deployed.

Go inside the ECS console > go inside the cluster > go inside the task and copy the public ip.

Copy task public ip

 

React js app

ECS is successfully deployed.

When we changed the source code, the pipeline got auto triggered and changed the content.

 

DO YOU HAVE ANY QUESTIONS?

Should you require help in performing the pipeline steps, feel free to contact at our email id [email protected]

Website – www.easydeploy.io/contact-us

Leave a Reply

Your email address will not be published. Required fields are marked *

back to top
advanced-floating-content-close-btn

Contact Us to save your AWS bill by 40%

X