How to run Jenkins using Docker on AWS EC2 instance with Terraform. Step-by-step DevOps Guide.
In my previous guide, “How to run Jenkins using Docker on an AWS EC2 Ubuntu instance” I wrote about the step-by-step manual process to do that using AWS Console.
Today I want to talk about the way to do it using Terraform.
Not a member? Click here to read this article for free.
Infrastructure as Code quickly became standard in industry.
Using tools like Terraform, you can create and destroy the whole infrastructure by running a few commands only.
Let’s see how we can create the following configuration using Terraform:
- Create an EC2 Linux instance.
- Install Docker on an EC2 instance.
- Run Jenkins on Docker and print the public IP.
- Access Jenkins from your browser.
Prerequisites:
- AWS account.
- Install AWS CLI.
- Install Terraform.
- AWS associated credentials that allow you to create resources.
- You can also read the AWS Get Started Terraform manual.