{"id":26366,"date":"2019-03-26T16:32:40","date_gmt":"2019-03-26T21:32:40","guid":{"rendered":"https:\/\/centricconsulting.com\/?p=26366"},"modified":"2021-12-15T00:15:58","modified_gmt":"2021-12-15T05:15:58","slug":"part-3-building-a-fully-operational-devops-platform-on-aws-using-terraform_devops","status":"publish","type":"post","link":"https:\/\/centricconsulting.com\/blog\/part-3-building-a-fully-operational-devops-platform-on-aws-using-terraform_devops\/","title":{"rendered":"Part 3: Building a DevOps Platform on AWS using Terraform"},"content":{"rendered":"

In this part of the series, we continue to explain how to build a fully operational DevOps platform on AWS using Terraform.<\/h2>\n

In\u00a0Part 1<\/a> and Part 2<\/a>\u00a0of the series we focused on building out the AWS infrastructure (networking, routing, etc.) and DevOps Application servers (EC2 instances and configuration, database, Redis, etc.).<\/p>\n

In Part 3 I will again build additional Terraform scripts which build out the Fargate cluster to run our application and an Elastic Container Registry (ECR) to store our application images. This will set us up for the final Part 4, where we will deploy our containerized application to AWS Fargate using the Jenkins scrips and our sample application code.<\/p>\n

Let\u2019s get started\u2026<\/strong><\/p>\n

This next section of script will address building out an Elastic Container Environment utilizing the AWS Fargate service.<\/p>\n

fg_cloudwatch.tf<\/h4>\n

This script will create a CloudWatch log group where our \u201cHello World\u201d Fargate tasks will log all activities related to starting, stopping and configuring the containers.<\/p>\n

\"AWS\"<\/a><\/p>\n

fg_ecr.tf<\/h4>\n

This script is responsible for creating our Elastic Container Repository (ECR) \u201cmyapp-repo\u201dwhere Jenkins will push our application images and Fargate will pull the image.<\/p>\n

\"AWS\"<\/a><\/p>\n

fg_elb.tf<\/h4>\n

When we later deploy copies of our application into containers, we will need a load balancer to manage load balancing to each container. Here we will create an application load balancer and associated listener and target group to place our container apps.<\/p>\n

Our load balancer will be listening on port 80 and forwarding traffic to the containers on port 80 (HTTP). We will later reference the target group when building out our Fargate container service to ensure our apps are deployed behind this load balancer.<\/p>\n

\"Terraform\"<\/a><\/p>\n

fg_iam.tf<\/h4>\n

Later when we build out a Fargate task, we will need to define two (2) roles for the task:<\/p>\n