This is a project for demonstrating the ability to automate processes of provisioning and configuration management in a live environment with the latest DevOps practices.
The task is designed to showcase the skill level in automation, configuration management, and scripting.
- Overview
- Features
- Interview-questions
- Installation
- Usage
- Description
- Pre-conditions
- Contributing
- License
-
Provision a New Virtual Machine a. Use Terraform (or any preferred IaC tool) to provision a new Windows EC2 instance on AWS or another cloud provider.
-
Automate Machine Setup a. Create an automation process to configure the machine after launch. You may use Ansible, user_data scripts, or any other preferred automation tool. The automation should achieve the following: i. Install IIS and configure it to host a new website. ii. Deploy the website from the following repository as a reference: https://github.com/AzureWorkshops/samples-simple-iis-website iii. Ensure the IIS setup is ready to automatically deploy any .NET application in the future.
-
Install and Configure Prometheus Exporter a. Install a Prometheus exporter (e.g., Windows Exporter). b. Configure the exporter to expose server metrics on localhost:9090.
-
Create a Scheduled Task a. Implement a scheduled task (should be done automatically when machine will start) that runs every 5 minutes to: b. Perform an HTTP POST request to send all Prometheus data (localhost:9090) to a temporary API endpoint like Pipedream RequestBin.
-
Develop a PowerShell Script a. Write a PowerShell script to: i. Generate a dump file of the deployed IIS website automatically. ii. Ensure the script is stored on the VM.
-
Generate IIS Usage Report • Based on the logs from IIS, create a script or tool that generates a summary/report including: o The most active times for the website. o A summary of errors encountered (e.g., 404, 500 errors). o User browser statistics (e.g., Chrome, Firefox, etc.). • Provide the report in a human-readable format, such as JSON, CSV, or an HTML page.
-
Harden the Instance • Apply security hardening measures to the instance to make it production-ready.
The following project is completing all the interview questions mentioned Above with only one terraform apply, and a few pre-requisites
This section will describe the Project usage and Installation:
-
Start with cloning the repository with git:
git clone https://github.com/Dan4ik7/Infigo
-
Connect to you AWS account and create a Key-pairs for the instance so you would be able to connect via RDP to the instance Key-Pairs Path: EC2 -> Network & Security -> Key Pairs -> Create a .pem file and download it
-
Go to the cloned Repository, inside the terraform folder: Initialize terraform a. First set up your aws Credentials: *For ease of ussage, I have exported the access keys directly in CLI as a environment vars:
$env:AWS_ACCESS_KEY_ID="<KEY_ID>" $env:AWS_SECRET_ACCESS_KEY="<SECRET_ID>"
-
Apply configurations:
terraform plan terraform apply --auto-approve
-
Connect to the Instance and Monitor the configuration Process: The terraform has created the security group to allow RDP trafiic. In order to connect to the instance via RDP go to your aws account: EC2 -> Instances -> Click on running instance -> Connect -> Click on RDP Client -> Click on Get Password and upload the .pem file created earlier in key pairs -> Decrypt Password -> Copy Password -> Click on Download Remote Desktop file and login to the EC2:
-
Monitor the Configuration Process - In case for any errors, re-run the user data script which will be available in the "C:\temp\userdata.ps1"
-
The following provisioning and configuration process is fully automated:
- Provisioning:
- EC2 Windows server allong with it's required resources
- S3 Bucket for File upload/downlod - for Grafana
- Configuration:
-
IIS server
-
Deploys a web app from Sample App
-
Exposes the Web APP to the <http:<Instance_PUB_IP>:8080> and localhost:8080
-
Ensures that IIS setup is ready to automatically deploy any .NET application in the future.
-
Generate a dump file of the deployed IIS webstie
-
Installs Prometheos and Exposes server metrics at localhost:9090
-
Creates a Scheduled Task to be run every 5 minutes, that sents the metrics to an API Endpoint like Pipedream:
https://eofnzuh3c3qiljs.m.pipedream.net
-
- Provisioning:
-
The Project completes every asspect of the Interview Task:
-
All the Executed Transcript is stored in "C:\temp" directory
- Two files: windows-exporter.txt and userdata.txt
-
The generated dump file is stored in "C:\temp"
-
The Usage Report is stored in "C:\Users\Administrator\AppData\Local\Temp\2" Three Files: IISUsageReport.html; IISUsageReport.csv; IISUsageReport.json
-
Test IIS Ready: After running the script, you can check if IIS is installed by running the following PowerShell command:
After running the script, you can check if IIS is installed by running the following PowerShell command:
Check the ASP.NET Core Hosting Bundle: Ensure that the ASP.NET Core Hosting Bundle is installed by checking the registry again:
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework"
Provide guidelines for contributing here.
This project is licensed under the terms of the LICENSE.