{"id":25968,"date":"2019-02-26T12:55:05","date_gmt":"2019-02-26T18:55:05","guid":{"rendered":"https:\/\/centricconsulting.com\/?p=25968"},"modified":"2021-12-15T00:15:52","modified_gmt":"2021-12-15T05:15:52","slug":"part-1-scripting-a-vpc-landing-zone-using-terraform-on-aws_devops","status":"publish","type":"post","link":"https:\/\/centricconsulting.com\/blog\/part-1-scripting-a-vpc-landing-zone-using-terraform-on-aws_devops\/","title":{"rendered":"Part 1: Scripting a VPC Landing Zone Using Terraform on AWS"},"content":{"rendered":"

Learn how to use infrastructure as code to create services in AWS using Terraform.<\/h2>\n

Part one of a four-part series<\/a>.<\/em><\/p>\n

In this blog, I will describe how\u00a0<\/span>to build<\/span>\u00a0the core infrastructure in Amazon Web Services (AWS) to support our Continuous Integration platform. <\/span><\/p>\n

We will refer to this as the \u201cLanding Zone,\u201d which will consist of components like VPCs, Subnets, Gateways and Routing Tables, Security and Identity Management, and more.<\/span><\/p>\n

The platform architecture I\u2019ll build to support the CI system is represented in the following diagram.\u00a0<\/strong><\/p>\n

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

A Look Ahead<\/h2>\n

At the end of this series, the\u00a0final\u00a0platform\u00a0will consist of\u00a0a Jenkins cluster with a dedicated Master and multiple slaves configured in an autoscaling group,\u00a0a GitLab code repository deployed in a HA configuration with external Elastic File System (EFS) volumes, a hosted Redis cluster,\u00a0<\/strong>a multi-AZ Postgresql database, and an Elastic Container Registry to store Docker images.<\/strong> <\/span><\/p>\n

The Jenkins Master and GitLab servers sit behind an application load balancer with public access, allowing developers to remotely manage the code base and manage the Jenkins pipelines.\u00a0<\/span>\u00a0<\/span><\/p>\n

The cluster of application servers will consist of an autoscaling group of Jenkins masters, Jenkins slaves and Gitlab servers deployed in private subnets behind an application load balancer. The autoscaling configuration will maintain one Jenkins master, two Jenkins Slaves, and two GitLab instances at any given time. <\/span><\/p>\n

During deployment and initial configuration, only a single GitLab server will be deployed. Once GitLab has been configured for high availability, we will scale up the autoscaling group from one to two servers to provide redundancy.<\/span>\u00a0<\/span><\/p>\n

For secure external access to the internet from <\/span>instances within the\u00a0<\/span>private subnets, a NAT gateway will be deployed into a public subnet.\u00a0<\/span>The private instance will use the NAT gateway to get out to the internet\u00a0<\/span>for things such as package and patch installs.<\/span>\u00a0<\/span>\u00a0<\/span><\/p>\n

Finally, a Linux bastion host will be deployed in a public subnet to allow access to EC2 instances in the private subnets from external users.<\/span>\u00a0<\/span><\/p>\n

The entire platform will be scripted and stored as infrastructure as code so that it can be recovered quickly or deployed in another region in the event of a disaster.<\/span>\u00a0<\/span><\/p>\n

Deployment\u00a0Part\u00a01<\/h2>\n

The deployment\u00a0<\/span>I\u2019ll build in this initial part of the blog series\u00a0<\/span>will consist of<\/span>\u00a0the following services. This will provide the foundation for the service I\u2019ll be adding later in this blog series.<\/span>\u00a0<\/span><\/p>\n