HTTPS SSH

Interview Homework

Solution implementation

  • Run the following
pip install -r requirements.txt -t .vendor 
zip -r ../iview.zip .vendor lambda.py
aws lambda update-function-code --function-name influx-count-instances --zip-file fileb://../iview.zip
  • Set environment variables thusly, e.g.
  • INFLUXDB=10.0.0.1
  • INFLUXDB=influx1.troxor.net

  • Execute with the included IAM policy

Problem 1

Scenario

Due to data requirements, developers need to spin up application and database instances in a special AWS account to be able to test their code. In order to contain costs, the SRE team needs to keep track of how many instances are running at any given time to make sure that we do not cross certain cost thresholds.

Requirement

Create a Lambda function that can be run on a regular schedule (Cloudwatch Events) that get the number of EC2 Instances running in an account that have a specific tag and put the results in an InfluxDB.

Instructions

Fork this repo to your personal GitHub account. After you have completed your function, email a link to your repository for review (an address will be provided to you). For convenience. , an InfluxDB Docker compose file is included to spin up the InfluxDB

What You Will Need

  1. A GitHub account
  2. AWS Account
  3. Docker