Overview

Part 1: Terraform configuration

This part of the tech test aims to assess the candidate's understanding of Terraform and their ability to work with and set up infrastructure as code for AWS.

The goal is to set up a couple of servers in the cloud and network them so that specific

Requirements for the configuration:

Define two EC2 instances: one for the Bastion (Amazon Linux 2) and one for the web server. Specify the instance type, region, AMI ID, and other necessary configuration options. Use the "aws_instance" resource in Terraform to create the instances.

Create security groups for the Bastion instance that allows incoming traffic on port 22 only. Use the "aws_security_group" resource in Terraform to create the security groups.

Create a security group for the web server instance that allows incoming traffic on ports 80 and 443 from the public internet and port 22 from the bastion machine.

Create an Elastic IP address that will be associated with the web server instance. Use the "aws_eip" resource in Terraform to create the Elastic IP.

Validate the configuration is “runnable” with terraform validate

Part 2: Diagnosing a Docker image

This tech test aims to assess the candidate's ability to diagnose issues.

The following is a broken docker file, diagnose the issue(s) and fix them so that you can view the file from http://localhost:8080 by running the following commands: docker build . -t tech-test docker run -p 8080:80 tech-test

@TODO: Upgrade this to php:7.4-apache-bullseye

FROM php:7.3-apache-stretch as app

RUN apt-get update && apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libpng-dev
libmagickwand-dev
imagemagick
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
&& docker-php-ext-install
gd
mbstring
opcache
mysqli
pdo_mysql
&& pecl install imagick
&& docker-php-ext-enable imagick

COPY index.html /code

WORKDIR /app

NOTE: You will need to create an index.html file in the same directory as your docker file

Part 3: Diagnosing a website uptime issue

This details a fairly common scenario, spend 10-15 minutes coming up with steps/a plan to diagnose the issue. The app was previously stable and not experiencing crashes.

The website is:

A standard Laravel/PHP app running with nginx in a container

An ECS service hosted on reserved EC2s

Uses RDS/MySQL for the main database

Uses ElastiCache/Redis for the application sessions/cache

The website is intermittently going down, Nginx is reporting:

And no application crashes are being recorded.

List out the steps you would perform to diagnose this issue and order in priority for the quickest resolution.