Integrating Amazon ECS with Jenkins: A Guide to Dynamic Build Environments


In today’s blog, we’ll dive into a practical tutorial on how to set up Amazon Elastic Container Service (ECS) as a Jenkins node. This allows you to leverage the power of containerization to scale your Jenkins build environment efficiently. Let’s get started!

Why Use Amazon ECS with Jenkins?

Amazon ECS is a powerful service that allows you to run and scale containerized applications on AWS. By integrating ECS with Jenkins, you can dynamically provision build agents as needed, improving resource utilization and enabling faster build times.


Before we begin, ensure you have the following:

  1. An AWS account with appropriate permissions to create ECS resources.
  2. Jenkins installed and running. You can use Jenkins on AWS, or set it up locally or on another server.
  3. Docker installed on your Jenkins server.

Steps to Add ECS as a Jenkins Node

Step 1: Create an ECS Task Definition

First, we need to define a task that will run our Jenkins agent as a container in ECS.

  1. Task Definition:
    • Go to the ECS console in your AWS Management Console.
    • Click on “Task Definitions” in the left-hand navigation pane.
    • Click “Create new Task Definition”.
    • Choose “Fargate” or “EC2” launch type based on your preference.
    • Configure your task with the necessary parameters (e.g., CPU, memory, container definition).
  1. Container Definition:
    • Add a container definition within the task.
    • Specify your Docker image (e.g., jenkins/jnlp-slave) and any required environment variables.
  1. Task Execution Role:
    • Ensure your task has an execution role with the necessary permissions (e.g., accessing ECR repositories, logging to CloudWatch).

Step 2: Configure Jenkins to Use ECS

Now, let’s configure Jenkins to use ECS as a build node.

  1. Install Plugins:
    • In Jenkins, navigate to “Manage Jenkins” > “Manage Plugins”.
    • Install the “Amazon EC2 Container Service Plugin” if not already installed.
  2. Configure Cloud Settings:
    • Go to “Manage Jenkins” > “Configure System”.
    • Scroll down to the “Cloud” section.
    • Click “Add a new cloud” > “Amazon EC2 Container Service Cloud”.
  1. Configure ECS Details:
    • Enter your ECS cluster ARN.
    • Choose the task definition and container name created earlier.
    • Configure other settings like subnets, security groups, and task placement.

Step 3: Add ECS as a Jenkins Node

Finally, let’s add ECS as a Jenkins node.

  1. Create Node:
    • In Jenkins, go to “Manage Jenkins” > “Manage Nodes & Clouds” > “Configure Clouds”.
    • Click “Add a new node” > “ECS container”.
  2. Node Configuration:
    • Enter a name for your ECS node.
    • Choose the ECS cloud (configured earlier).
    • Specify any labels or settings needed for your build jobs.
  3. Save Configuration:
    • Click “Save” to add the ECS node.


Congratulations! You’ve successfully added Amazon ECS as a Jenkins node. This setup enables Jenkins to dynamically provision build agents using containerization, providing scalability and flexibility to your CI/CD workflows.

By leveraging AWS ECS with Jenkins, you can optimize resource utilization, reduce infrastructure costs, and streamline your continuous integration and delivery processes.

We hope you found this tutorial helpful. Feel free to leave comments or questions below. Happy building with Jenkins and ECS!

About the author

Add Comment

By atulyw


Get in touch

Quickly communicate covalent niche markets for maintainable sources. Collaboratively harness resource sucking experiences whereas cost effective meta-services.