Terraform

HashiCorp Terraform is a tool for building, changing, and versioning infrastructure that has an open-source and enterprise version. Unlike AWS CloudFormation, which can only be used on AWS, Terraform is cloud agnostic and can be used to create multi-cloud infrastructure as well as on-prem. It’s written in a human readable, machine consumable language called HashiCorp Configuration Language (HCL).

Jenkins Pipeline

Jenkins is a self-contained, open source automation server used to automate tasks associated with building, testing, and delivering/deploying software. Jenkins Pipeline implements continuous deliver pipelines into Jenkins through use of plugins and a Jenkinsfile. …


Requirements

  1. Create a highly available two-tier AWS architecture containing the following:
  • 3 Public Subnets
  • 3 Private Subnets
  • Auto Scaling Group for Bastion Host
  • Auto Scaling Group for Web Server
  • Internet-facing Application Load Balancer targeting Web Server Auto Scaling Group

2. Deploy this using Terraform Cloud as a CI/CD tool to check your build.

3. Use module blocks for ease of use and re-usability.

Prerequisites

Notes

In previous articles, I’ve gone into detail about my…


Use Case

A simple Terraform file has been made by team member in your organization to launch an EC2 instance. Your company would like to use this template as the standard for launching EC2 instances, however it does not currently follow Terraform best practices. You have been directed to modify the file so that it is a module, allowing easy re-use by team members within the company.

Steps

  1. Fork and clone the original repo locally with the ec2.tf template as a starting point to create the EC2 : https://github.com/LevelUpInTech/terraformec2.git
  2. Create a custom module for EC2 out of the resource block that can be…


Cleaning up my AWS Three-Tier Architecture Deployment part 1

In a previous post, Terraform: Deploy A Three-Tier Architecture in AWS, I used Terraform to create AWS infrastructure, however I did not use Terraform recommended best practices. I used a single main.tf file and hard-coded everything. As I’m just beginning my journey with Terraform, hopefully this can be forgiven. In an attempt to make up for my past sins, I plan to convert my original project using the best practices that I neglected the first time around. I plan to do this in stages and for this post I’ll be adding variables and count.

Please refer to my previous post…


Elastic Container Service (ECS)

Amazon Elastic Container Service is a fully managed container orchestration service, which integrates with the AWS platform and helps to deploy, manage, and scale containerized applications. Amazon ECS allows you to quickly launch containers using various compute options and even integrates with CI/CD and automation tools. Containers are defined in a task definition that are used to run individual tasks or tasks that are in a service. Tasks and services can be run on a cluster of Amazon EC2 instances or serverless infrastructure that is managed by AWS Fargate. …


Infrastructure as Code (IaC)

The cloud gives us the ability to create our environments quickly, but the problem that arises is how to configure and manage the environments. Manually updating from the console may be acceptable for a small organization in a single region, but what if you have to create and maintain environments in multiple regions? Not only is it an inefficient use of time to create and maintain everything, but it’s also error-prone.

Imagine that you are asked to create an environment in a single Region. Not really a big deal and you are able to complete the task with relative ease…


Using AWS Systems Manager, Session Manager & AWS Single Sign-On.

Photo by FLY:D on Unsplash

Use Case:
In the past, your company has used a bastion host in a public subnet to access your EC2 instances. The problem with this is that in order to do so, you need to have a port open to the internet. In addition to this security risk, you will also need to manage the bastion host availability and users’ permissions to access the bastion host. Your company would like to tighten up security and reduce their attack surface by adding remote access through AWS Systems Manager Session Manager with AWS Single Sign-On.

AWS Systems Manager Session Manager

AWS Systems Manager Session Manager provides secure…


Docker

Docker allows users to separate applications from their infrastructure, allowing for quick deployments. Docker allows users to package and run an application in something called a container. Containers have everything needed to run an application and users don’t have to worry about what is installed on the host. This allows team members to easily duplicate environments rather than having to manually download all of the application's dependencies. Docker also guarantees that a Development environment will match a Production environment, solving the usual “well it worked in Development” issue.

Amazon S3

Amazon Simple Storage Service (S3) is a highly available object storage solution…


What is AWS Backup?

AWS Backup allows you to centrally manage backups, automate backup processes and improve backup compliance. AWS Backup can be used with AWS resources such as Amazon EBS volumes, Amazon RDS databases, Amazon DynamoDB tables, Amazon EFS, and AWS Storage Gateway to provide a fully managed, policy based backup solution. AWS Backup’s Backup policies make it ideal to protect applications running in AWS. Through a Backup policy an administrator can schedule the frequency of backups, create a lifecycle policy, assign resources using tags or ARNs, and manage backups.

Prerequisites

  1. AWS Account
  2. User with Admin Permissions

Create EC2

We will create an EC2 instance with…


Prerequisites

  • Python3 installed
  • Preferred IDE

Our Data

  1. Create a file named data.py
  2. Enter the following to create a dictionary named question_data:

Create Question Class

  1. Create a file named question_model.py.
  2. Use the following to define the Question class and parameters.

Create Test Bank

  1. Create a file named main.py.
  2. Import the question_data dictionary from data.py on line 1.
  3. Import the Question class from question_model.py on line 2.
  4. Create an empty question_bank and set it to an empty list on line 4.
  5. Run a for loop on lines 5. This for loop will cycle through all the items in the question_data dictionary executing each of the indented actions.
  6. On line…

Troy Ingram

DevOps Engineer | AWS Certified Solutions Architect - Associate | Terraform Associate | Python | Linux

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store