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 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 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.


  1. AWS Account
  2. User with Admin Permissions

Create EC2

We will create an EC2 instance with…


  • Python3 installed
  • Preferred IDE

Our Data

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

Create Question Class

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

Create Test Bank

  1. Create a file named
  2. Import the question_data dictionary from on line 1.
  3. Import the Question class from 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…

Each of your Python projects will use the same directories by default. An issue comes into play when you have projects that are using different versions of Python. Virtual environments are important to keep dependencies required by different projects separated.

In this project we will:

  1. Create a user, download credentials, and set up the AWS CLI
  2. Create an Ubuntu 20.04 Ec2 instance (t2. micro)
  3. Connect and log in to the instance using a keypair
  4. Refresh updates and upgrade all packages on the instance
  5. Create a directory called “environment” and create a virtual python environment in that directory.
  6. Activate that virtual…

Infrastructure as Code (IaC)

When creating your cloud infrastructure, it’s easy to use the AWS Console to quickly provision resources. The problem begins when you need to duplicate those resources in other Regions, when you need to make changes to your environments, or if there is a disaster recovery scenario.

Infrastructure as Code solves this problem by doing exactly what the name implies, it turns your infrastructure into code. You treat the code just like you would any other code with source control and versioning. IaC allows you to automate DevOps best practices by starting a git repository and deploying through a CI/CD pipeline…

For my first Python project, I created a brand name generator that asks the user a set of questions, sets their answers as variables, and prints out a response.

Installing Python

For this project, I am using a Centos7 server with Virtual Studio Code installed using a cloud playground server from A Cloud Guru. I used pyenv to download Python 3.7.6. Refer to the for more detailed instructions.

Python Code

First I made a new directory named pythonprojects by running mkdir pythonprojects. Then navigate into that directory by running cd pythonprojects. I then created a new file named

This script will…

Troy Ingram

Aspiring DevOps Engineer documenting my journey.

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